public ActionResult Edit(int Id) { var blogComment = new BlogCommentDao().GetBlogCommentById(Id); if (blogComment == null) { Response.StatusCode = (int)HttpStatusCode.NotFound; return(View()); } return(View(blogComment)); }
// GET: Admin/BlogComment public ActionResult Index(DateTime?SearchCreatedFrom, DateTime?SearchCreatedTo, int SearchIsApproved = 0, string SearchMessage = null, int page = 1, int pageSize = 10) { var CreatedFrom = SearchCreatedFrom.HasValue ? Convert.ToDateTime(SearchCreatedFrom) : DateTime.Now; var CreatedTo = SearchCreatedTo.HasValue ? Convert.ToDateTime(SearchCreatedTo) : DateTime.Now; var blogComment = new BlogCommentDao().GetBlogComments(CreatedFrom, CreatedTo, SearchIsApproved, SearchMessage, page, pageSize); ViewBag.SearchCreatedFrom = CreatedFrom; ViewBag.SearchCreatedTo = CreatedTo; ViewBag.SearchIsApproved = SearchIsApproved; ViewBag.SearchMessage = SearchMessage; return(View(blogComment)); }
public ActionResult Delete(int Id) { var result = new BlogCommentDao().DeleteBlogComment(Id); if (result) { SetNotification("Xoá Blog Comment thành công .", "success"); return(RedirectToAction("Index", "BlogComment")); } else { ModelState.AddModelError("", "Xoá Blog Comment không thành công ."); } return(View()); }
public ActionResult AddComment(BlogComment comment) { if (ModelState.IsValid) { BlogCommentDao blogComment = new BlogCommentDao(); comment.CommentDate = DateTime.Now; blogComment.Create(comment); TempData["message-success"] = "Komentář přidán"; } return RedirectToAction("ArticleDetail"); }
public ActionResult Edit(BlogComment blogComment) { if (ModelState.IsValid) { var blogCommentDao = new BlogCommentDao(); var result = blogCommentDao.UpdateBlogComment(blogComment); if (result) { SetNotification("Cập nhật Blog Comment thành công .", "success"); return(RedirectToAction("Index", "BlogComment")); } else { ModelState.AddModelError("", "Cập nhật Blog Comment không thành công ."); } } return(View()); }
public ActionResult Create(BlogComment blogComment) { if (ModelState.IsValid) { var blogCommentDao = new BlogCommentDao(); var Id = blogCommentDao.InsertBlogComment(blogComment); if (Id > 0) { SetNotification("Thêm mới Blog Comment thành công .", "success"); return(RedirectToAction("Index", "BlogComment")); } else { ModelState.AddModelError("", "Thêm mới Blog Comment không thành công ."); } } return(View()); }
public ActionResult ShowComment(int id) { int totalComment; IList<BlogComment> comments = new BlogCommentDao().GetCommentByArticleId(out totalComment, id); ViewBag.Comment = totalComment; return View(comments); }