Added DateEdited property to blogs and podcasts (not viewable yet)tags/2.0.3
@@ -162,6 +162,7 @@ namespace Teknik.Areas.Blog.Controllers | |||
post.System = system; | |||
post.DatePosted = DateTime.Now; | |||
post.DatePublished = DateTime.Now; | |||
post.DateEdited = DateTime.Now; | |||
db.BlogPosts.Add(post); | |||
db.SaveChanges(); | |||
@@ -185,6 +186,7 @@ namespace Teknik.Areas.Blog.Controllers | |||
{ | |||
post.Title = title; | |||
post.Article = article; | |||
post.DateEdited = DateTime.Now; | |||
db.Entry(post).State = EntityState.Modified; | |||
db.SaveChanges(); | |||
return Json(new { result = true }); | |||
@@ -286,6 +288,7 @@ namespace Teknik.Areas.Blog.Controllers | |||
comment.UserId = db.Users.Where(u => u.Username == User.Identity.Name).First().UserId; | |||
comment.Article = article; | |||
comment.DatePosted = DateTime.Now; | |||
comment.DateEdited = DateTime.Now; | |||
db.BlogComments.Add(comment); | |||
db.SaveChanges(); | |||
@@ -308,6 +311,7 @@ namespace Teknik.Areas.Blog.Controllers | |||
if (comment.User.Username == User.Identity.Name || User.IsInRole("Admin")) | |||
{ | |||
comment.Article = article; | |||
comment.DateEdited = DateTime.Now; | |||
db.Entry(comment).State = EntityState.Modified; | |||
db.SaveChanges(); | |||
return Json(new { result = true }); |
@@ -17,7 +17,9 @@ namespace Teknik.Areas.Blog.Models | |||
public DateTime DatePosted { get; set; } | |||
public DateTime DatePublished { get; set; } | |||
public DateTime DateEdited { get; set; } | |||
public bool Published { get; set; } | |||
public string Title { get; set; } |
@@ -19,6 +19,7 @@ namespace Teknik.Areas.Blog.Models | |||
public User User { get; set; } | |||
public DateTime DatePosted { get; set; } | |||
public DateTime DateEdited { get; set; } | |||
public string Article { get; set; } | |||
} |
@@ -16,6 +16,7 @@ namespace Teknik.Areas.Blog.ViewModels | |||
public int? UserId { get; set; } | |||
public User User { get; set; } | |||
public DateTime DatePosted { get; set; } | |||
public DateTime DateEdited { get; set; } | |||
public string Article { get; set; } | |||
public CommentViewModel(BlogPostComment comment) | |||
@@ -26,6 +27,7 @@ namespace Teknik.Areas.Blog.ViewModels | |||
UserId = comment.UserId; | |||
User = comment.User; | |||
DatePosted = comment.DatePosted; | |||
DateEdited = comment.DateEdited; | |||
Article = comment.Article; | |||
} | |||
} |
@@ -22,6 +22,8 @@ namespace Teknik.Areas.Blog.ViewModels | |||
public DateTime DatePublished { get; set; } | |||
public DateTime DateEdited { get; set; } | |||
public bool Published { get; set; } | |||
public string Title { get; set; } | |||
@@ -41,6 +43,7 @@ namespace Teknik.Areas.Blog.ViewModels | |||
DatePosted = post.DatePosted; | |||
Published = post.Published; | |||
DatePublished = post.DatePublished; | |||
DateEdited = post.DateEdited; | |||
Title = post.Title; | |||
Tags = post.Tags; | |||
Article = post.Article; |
@@ -58,11 +58,7 @@ namespace Teknik.Areas.Podcast.Controllers | |||
var foundPodcast = db.Podcasts.Include("Files").Where(p => ((p.Published || editor) && p.Episode == episode)).FirstOrDefault(); | |||
if (foundPodcast != null) | |||
{ | |||
model.PodcastId = foundPodcast.PodcastId; | |||
model.Episode = foundPodcast.Episode; | |||
model.Title = foundPodcast.Title; | |||
model.Description = foundPodcast.Description; | |||
model.Files = foundPodcast.Files; | |||
model = new PodcastViewModel(foundPodcast); | |||
ViewBag.Title = model.Title + " - Teknikast - " + Config.Title; | |||
return View("~/Areas/Podcast/Views/Podcast/ViewPodcast.cshtml", model); | |||
@@ -180,6 +176,7 @@ namespace Teknik.Areas.Podcast.Controllers | |||
podcast.Description = description; | |||
podcast.DatePosted = DateTime.Now; | |||
podcast.DatePublished = DateTime.Now; | |||
podcast.DateEdited = DateTime.Now; | |||
// Handle saving of files | |||
for (int i = 0; i < Request.Files.Count; i++) | |||
@@ -188,7 +185,6 @@ namespace Teknik.Areas.Podcast.Controllers | |||
//Use the following properties to get file's name, size and MIMEType | |||
int fileSize = file.ContentLength; | |||
string fileName = file.FileName; | |||
string mimeType = file.ContentType; | |||
string fileExt = Path.GetExtension(fileName); | |||
if (!Directory.Exists(Config.PodcastConfig.PodcastDirectory)) | |||
{ | |||
@@ -205,7 +201,8 @@ namespace Teknik.Areas.Podcast.Controllers | |||
PodcastFile podFile = new PodcastFile(); | |||
podFile.Path = fullPath; | |||
podFile.FileName = newName; | |||
podFile.ContentType = mimeType; | |||
podFile.ContentType = file.ContentType; | |||
podFile.ContentLength = file.ContentLength; | |||
podcast.Files = new List<PodcastFile>(); | |||
podcast.Files.Add(podFile); | |||
@@ -241,6 +238,7 @@ namespace Teknik.Areas.Podcast.Controllers | |||
podcast.Episode = episode; | |||
podcast.Title = title; | |||
podcast.Description = description; | |||
podcast.DateEdited = DateTime.Now; | |||
db.Entry(podcast).State = EntityState.Modified; | |||
db.SaveChanges(); | |||
return Json(new { result = true }); | |||
@@ -344,6 +342,7 @@ namespace Teknik.Areas.Podcast.Controllers | |||
comment.UserId = db.Users.Where(u => u.Username == User.Identity.Name).First().UserId; | |||
comment.Article = article; | |||
comment.DatePosted = DateTime.Now; | |||
comment.DateEdited = DateTime.Now; | |||
db.PodcastComments.Add(comment); | |||
db.SaveChanges(); | |||
@@ -366,6 +365,7 @@ namespace Teknik.Areas.Podcast.Controllers | |||
if (comment.User.Username == User.Identity.Name || User.IsInRole("Admin")) | |||
{ | |||
comment.Article = article; | |||
comment.DateEdited = DateTime.Now; | |||
db.Entry(comment).State = EntityState.Modified; | |||
db.SaveChanges(); | |||
return Json(new { result = true }); |
@@ -25,6 +25,8 @@ namespace Teknik.Areas.Podcast.Models | |||
public DateTime DatePublished { get; set; } | |||
public DateTime DateEdited { get; set; } | |||
public List<PodcastComment> Comments { get; set; } | |||
} | |||
} |
@@ -20,6 +20,8 @@ namespace Teknik.Areas.Podcast.Models | |||
public DateTime DatePosted { get; set; } | |||
public DateTime DateEdited { get; set; } | |||
public string Article { get; set; } | |||
} | |||
} |
@@ -19,6 +19,8 @@ namespace Teknik.Areas.Podcast.Models | |||
public string ContentType { get; set; } | |||
public int ContentLength { get; set; } | |||
public int Size { get; set; } | |||
} | |||
} |
@@ -14,6 +14,7 @@ namespace Teknik.Areas.Podcast.ViewModels | |||
public Models.Podcast Podcast { get; set; } | |||
public User User { get; set; } | |||
public DateTime DatePosted { get; set; } | |||
public DateTime DateEdited { get; set; } | |||
public string Article { get; set; } | |||
public CommentViewModel(Models.PodcastComment comment) | |||
@@ -23,6 +24,7 @@ namespace Teknik.Areas.Podcast.ViewModels | |||
Podcast = comment.Podcast; | |||
User = comment.User; | |||
DatePosted = comment.DatePosted; | |||
DateEdited = comment.DateEdited; | |||
Article = comment.Article; | |||
} | |||
} |
@@ -27,6 +27,8 @@ namespace Teknik.Areas.Podcast.ViewModels | |||
public DateTime DatePublished { get; set; } | |||
public DateTime DateEdited { get; set; } | |||
public PodcastViewModel() { } | |||
public PodcastViewModel(Models.Podcast podcast) | |||
@@ -40,6 +42,7 @@ namespace Teknik.Areas.Podcast.ViewModels | |||
DatePosted = podcast.DatePosted; | |||
Published = podcast.Published; | |||
DatePublished = podcast.DatePublished; | |||
DateEdited = podcast.DateEdited; | |||
} | |||
} | |||
} |
@@ -0,0 +1,41 @@ | |||
using System.Collections.Generic; | |||
using System.Web.Mvc; | |||
namespace Teknik.Areas.RSS | |||
{ | |||
public class RSSAreaRegistration : AreaRegistration | |||
{ | |||
public override string AreaName | |||
{ | |||
get | |||
{ | |||
return "RSS"; | |||
} | |||
} | |||
public override void RegisterArea(AreaRegistrationContext context) | |||
{ | |||
context.MapSubdomainRoute( | |||
"RSS.Index", // Route name | |||
new List<string>() { "dev", "rss" }, | |||
"", // URL with parameters | |||
new { controller = "RSS", action = "Index" }, // Parameter defaults | |||
new[] { typeof(Controllers.RSSController).Namespace } | |||
); | |||
context.MapSubdomainRoute( | |||
"RSS.Blog", // Route name | |||
new List<string>() { "dev", "rss" }, | |||
"Blog/{username}", // URL with parameters | |||
new { controller = "RSS", action = "Blog", username = UrlParameter.Optional }, // Parameter defaults | |||
new[] { typeof(Controllers.RSSController).Namespace } | |||
); | |||
context.MapSubdomainRoute( | |||
"RSS.Podcast", // Route name | |||
new List<string>() { "dev", "rss" }, | |||
"Podcast", // URL with parameters | |||
new { controller = "RSS", action = "Podcast" }, // Parameter defaults | |||
new[] { typeof(Controllers.RSSController).Namespace } | |||
); | |||
} | |||
} | |||
} |
@@ -0,0 +1,36 @@ | |||
<?xml version="1.0"?> | |||
<configuration> | |||
<configSections> | |||
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> | |||
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> | |||
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> | |||
</sectionGroup> | |||
</configSections> | |||
<system.web.webPages.razor> | |||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> | |||
<pages pageBaseType="System.Web.Mvc.WebViewPage"> | |||
<namespaces> | |||
<add namespace="System.Web.Mvc" /> | |||
<add namespace="System.Web.Mvc.Ajax" /> | |||
<add namespace="System.Web.Mvc.Html" /> | |||
<add namespace="System.Web.Routing" /> | |||
<add namespace="System.Web.Optimization" /> | |||
<add namespace="Teknik" /> | |||
</namespaces> | |||
</pages> | |||
</system.web.webPages.razor> | |||
<appSettings> | |||
<add key="webpages:Enabled" value="false" /> | |||
</appSettings> | |||
<system.webServer> | |||
<handlers> | |||
<remove name="BlockViewHandler"/> | |||
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" /> | |||
</handlers> | |||
</system.webServer> | |||
</configuration> |
@@ -0,0 +1,36 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.ServiceModel.Syndication; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Web; | |||
using System.Web.Mvc; | |||
using System.Xml; | |||
namespace Teknik.Helpers | |||
{ | |||
public class RssResult : ActionResult | |||
{ | |||
public SyndicationFeed Feed { get; set; } | |||
public RssResult() { } | |||
public RssResult(SyndicationFeed feed) | |||
{ | |||
this.Feed = feed; | |||
} | |||
public override void ExecuteResult(ControllerContext context) | |||
{ | |||
context.HttpContext.Response.ContentType = "application/rss+xml"; | |||
Rss20FeedFormatter formatter = new Rss20FeedFormatter(this.Feed); | |||
using (XmlWriter writer = XmlWriter.Create(context.HttpContext.Response.Output)) | |||
{ | |||
formatter.WriteTo(writer); | |||
} | |||
} | |||
} | |||
} |
@@ -90,6 +90,7 @@ | |||
<Reference Include="System.Drawing" /> | |||
<Reference Include="System.Runtime.Serialization" /> | |||
<Reference Include="System.Security" /> | |||
<Reference Include="System.ServiceModel" /> | |||
<Reference Include="System.Web.DynamicData" /> | |||
<Reference Include="System.Web.Entity" /> | |||
<Reference Include="System.Web.ApplicationServices" /> | |||
@@ -194,6 +195,8 @@ | |||
<Compile Include="Areas\Profile\Controllers\ProfileController.cs" /> | |||
<Compile Include="Areas\Profile\ProfileAreaRegistration.cs" /> | |||
<Compile Include="Areas\Profile\ViewModels\ProfileViewModel.cs" /> | |||
<Compile Include="Areas\RSS\Controllers\RSSController.cs" /> | |||
<Compile Include="Areas\RSS\RSSAreaRegistration.cs" /> | |||
<Compile Include="Areas\Upload\Controllers\UploadController.cs" /> | |||
<Compile Include="Areas\Upload\Models\FileModel.cs" /> | |||
<Compile Include="Areas\Upload\Models\Upload.cs" /> | |||
@@ -223,6 +226,7 @@ | |||
<Compile Include="Areas\Blog\Models\BlogPost.cs" /> | |||
<Compile Include="Areas\Profile\Models\Role.cs" /> | |||
<Compile Include="Helpers\MarkdownHelper.cs" /> | |||
<Compile Include="Helpers\RSSFeedResult.cs" /> | |||
<Compile Include="Helpers\UrlExtensions.cs" /> | |||
<Compile Include="Helpers\Utility.cs" /> | |||
<Compile Include="Migrations\Configuration.cs" /> | |||
@@ -427,6 +431,7 @@ | |||
<Content Include="Areas\Podcast\Views\Podcast\Comments.cshtml" /> | |||
<Content Include="Areas\Podcast\Views\Podcast\ViewPodcast.cshtml" /> | |||
<Content Include="App_Data\Config.json" /> | |||
<Content Include="Areas\RSS\Views\web.config" /> | |||
<None Include="Properties\PublishProfiles\Teknik Dev.pubxml" /> | |||
<None Include="Scripts\jquery-2.1.4.intellisense.js" /> | |||
<Content Include="Scripts\bootbox\bootbox.min.js" /> | |||
@@ -516,6 +521,10 @@ | |||
<Folder Include="Areas\Privacy\Models\" /> | |||
<Folder Include="Areas\Privacy\Views\Shared\" /> | |||
<Folder Include="Areas\Profile\Views\Shared\" /> | |||
<Folder Include="Areas\RSS\Models\" /> | |||
<Folder Include="Areas\RSS\ViewModels\" /> | |||
<Folder Include="Areas\RSS\Views\RSS\" /> | |||
<Folder Include="Areas\RSS\Views\Shared\" /> | |||
<Folder Include="Areas\Upload\Views\Shared\" /> | |||
</ItemGroup> | |||
<ItemGroup> |