From 588d21569c6a6adfcb9a75c29c57c43dc7954f06 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 17 May 2017 16:23:55 -0400 Subject: individual post subjects --- Project-Unite/Views/Forum/ViewTopic.cshtml | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Project-Unite/Views/Forum/ViewTopic.cshtml') diff --git a/Project-Unite/Views/Forum/ViewTopic.cshtml b/Project-Unite/Views/Forum/ViewTopic.cshtml index ed6b7c0..61ef682 100644 --- a/Project-Unite/Views/Forum/ViewTopic.cshtml +++ b/Project-Unite/Views/Forum/ViewTopic.cshtml @@ -3,6 +3,16 @@ @using Microsoft.AspNet.Identity @{ ViewBag.Title = Model.Subject; + var db = new Project_Unite.Models.ApplicationDbContext(); + var posts = db.ForumPosts.Where(x => x.Parent == Model.Id); + foreach(var post in posts.ToArray()) + { + if (string.IsNullOrWhiteSpace(post.Subject)) + { + post.Subject = Model.Subject; + } + } + db.SaveChanges(); }