public PartialViewResult AddComment(FormCollection form) { int msgId = Convert.ToInt32(form["MessageId"]); string comment = form["NewComment"]; CommentsModels cm = new CommentsModels(); cm.MessageId = msgId; cm.Comment = comment; cm.CommentorsId = PostHelper.GetUserId(HttpContext.User.Identity.Name); cm.CreateComment(); List <CommentsModels> comments = PostsModels.GetPostByMessageId(msgId).Comments; return(PartialView("Comments", comments)); }
public PartialViewResult AddComment(FormCollection form) { int msgId = Convert.ToInt32(form["MessageId"]); string comment = form["NewComment"]; CommentsModels cm = new CommentsModels(); cm.MessageId = msgId; cm.Comment = comment; cm.CommentorsId = PostHelper.GetUserId(HttpContext.User.Identity.Name); cm.CreateComment(); List<CommentsModels> comments = PostsModels.GetPostByMessageId(msgId).Comments; return PartialView("Comments", comments); }