public ActionResult TopicItem(TopicViewModel topicViewModel) { ContentTopic topic = db.ContentTopics.Find(topicViewModel.Topic.Id); ContentComment post = db.ContentComments.Find(topic.FirstCommentId); topic.IsHidden = topicViewModel.Topic.IsHidden; topic.IsSticky = topicViewModel.Topic.IsSticky; topic.IsLocked = topicViewModel.Topic.IsLocked; db.SaveChanges(); topicViewModel.Topic = topic; topicViewModel.Post = post; return PartialView("_TopicItem", topicViewModel); }
public ActionResult CommentItem(TopicViewModel commentViewModel) { ContentComment commentItem = db.ContentComments.Find(commentViewModel.Post.Id); commentItem.IsHidden = commentViewModel.Post.IsHidden; commentItem.IsSpam = commentViewModel.Post.IsSpam; commentItem.IsLocked = commentViewModel.Post.IsLocked; commentItem.IsSolution = commentViewModel.Post.IsSolution; db.SaveChanges(); commentViewModel.Post = commentItem; ContentTopic topic = db.ContentTopics.Find(commentViewModel.Post.TopicId); commentViewModel.Topic = topic; return PartialView("_CommentItem", commentViewModel); }