コード例 #1
0
 public ActionResult Edit(FullCommentViewModel comment)
 {
     if (comment != null && !String.IsNullOrWhiteSpace(comment.Text))
     {
         _commentService.UpdateCommentEntity(comment.ToBllFullComment());
     }
     return(RedirectToAction("Details", "Article", new { id = comment.ArticleId }));
 }
コード例 #2
0
 public ActionResult Create(string Text, int id)
 {
     if (!String.IsNullOrWhiteSpace(Text))
     {
         var fullcomment = new FullCommentViewModel();
         fullcomment.ArticleId = id;
         fullcomment.User      = _userService.GetUserByNickname(User.Identity.Name).ToMvcUser();
         fullcomment.DateTime  = DateTime.Now;
         fullcomment.Text      = Text;
         _commentService.CreateCommentEntity(fullcomment.ToBllFullComment());
         if (Request.IsAjaxRequest())
         {
             return(Json(fullcomment));
         }
     }
     else
     {
         ModelState.AddModelError("Text", "Add your message");
     }
     return(RedirectToAction("Details", "Article", new { id }));
 }
コード例 #3
0
 public ActionResult Delete(FullCommentViewModel commentModel)
 {
     _commentService.DeleteCommentEntity(commentModel.ToBllFullComment());
     return(RedirectToAction("Details", "Article", new { id = commentModel.ArticleId }));
 }