コード例 #1
0
 public ActionResult NewComment(CreateCommentViewModel createCommentViewModel)
 {
     if (ModelState.IsValid)
     {
         var         userId     = Guid.Parse(Session["loginUserId"].ToString());
         IArticleBLL articleBLL = new ArticleBLL();
         articleBLL.CreateComment(userId, createCommentViewModel.ArticleId, createCommentViewModel.Content);
         return(RedirectToAction("ArticleDetails", new { id = createCommentViewModel.ArticleId }));
     }
     ModelState.AddModelError("", "invalid entry");
     return(RedirectToAction("ArticleDetails", new { id = createCommentViewModel.ArticleId }));
 }