public CommentDTO GetComments() { CommentDTO commentDTO = new CommentDTO(); commentDTO.Comments = commentDAO.GetComments(); return(commentDTO); }
public PartialViewResult PostComments(int postId) { IEnumerable <ViewCommentsModel> viewComments = new List <ViewCommentsModel>(); viewComments = ViewCommentsModel.GetListComments(CommentDAO.GetComments(postId)); return(PartialView("_Comments", viewComments)); }
public ActionResult Detail(int id) { Post post = PostDAO.FindId(id); List <Comment> comments = CommentDAO.GetComments(id); ViewBag.Post = post; ViewBag.Comments = comments; return(View()); }
public ViewPostModel(Post post) { PostId = post.PostId; PostTitle = post.PostTitle; PostBody = post.PostBody; PostDate = post.PostDate; AuthorId = post.AuthorId; Author = UserDAO.GetUsername(post.AuthorId); Comments = ViewCommentsModel.GetListComments(CommentDAO.GetComments(post.PostId)); }
public PartialViewResult AddComment(int PostId, string UserName, string Email, string CommentText) { int?userId = null; if (string.IsNullOrEmpty(User.Identity.Name)) { UserDAO.GetUserId(User.Identity.Name); } CommentDAO.AddComments(PostId, userId, UserName, Email, CommentText); IEnumerable <ViewCommentsModel> viewComments = new List <ViewCommentsModel>(); viewComments = ViewCommentsModel.GetListComments(CommentDAO.GetComments(PostId)); return(PartialView("_Comments", viewComments)); }