public ActionResult CreateComment([Bind(Include = "Content, AuthorId, TopicId")] CreateCommentBindModel model) { if (this.ModelState.IsValid) { this.service.AddComment(model); } return(this.RedirectToAction("ShowTeamTopic", new { topicId = model.TopicId })); }
public void AddComment(CreateCommentBindModel model) { var topic = this.topics.GetById(model.TopicId); var comment = new Comment() { Content = model.Content, Author = this.GetCurrentUser(model.AuthorId), Topic = topic }; topic.Comments.Add(comment); this.topics.Save(); }