public PartialViewResult CreatePost(FormCollection form) { PostsModels post = new PostsModels(); post.Message = form["NewPost"]; post.PostUserId = PostHelper.GetUserId(HttpContext.User.Identity.Name); post.CreatePost(); List <PostsModels> lstPost = PostHelper.GetPostPage(0, 10); return(PartialView("Posts", lstPost)); }
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)); }