コード例 #1
0
 public async Task<ActionResult> EditReply(CommentViewModel model, string replyid)
 {
     var user = await GetCurrentUserAsync();
     var reply = _blogRepository.GetReplyById(replyid);
     if (reply.UserName == user.UserName)
     {
         model.Id = replyid;
         model.Body = reply.Body;
         return View(model);
     }
     else
     {
         return RedirectToAction("Post", new { slug = _blogRepository.GetPosts().Where(x => x.Id == reply.PostId).FirstOrDefault().UrlSeo });
     }
 }
コード例 #2
0
 public async Task<ActionResult> DeleteComment(CommentViewModel model, string commentid)
 {
     var user = await GetCurrentUserAsync();
     var comment = _blogRepository.GetCommentById(commentid);
     if (comment.UserName == user.UserName)
     {
         model.Id = commentid;
         return View(model);
     }
     else
     {
         return RedirectToAction("Post", new { slug = _blogRepository.GetPosts().Where(x => x.Id == comment.PostId).FirstOrDefault().UrlSeo });
     }
 }