public ActionResult EditComment(CreateCommentViewDto comment, int postId) { if (!ModelState.IsValid) { return(View(comment)); } _commentService.EditComment(comment); return(RedirectToAction(HomeActions.Info, new { id = postId })); }
public ActionResult Info(CreateCommentViewDto createComment, int postId) { if (!ModelState.IsValid) { return(RedirectToAction(HomeActions.Info, new { id = postId })); } _commentService.AddCreatedComment(createComment, postId); return(RedirectToAction(HomeActions.Info, new { id = postId })); }
public void AddCreatedComment(CreateCommentViewDto comment, int ideaId) { comment.CreateOn = DateTime.Now; comment.AuthorId = _identityFacade.GetUserId(); comment.IdeaId = ideaId; comment.IsBlocked = false; var dbPost = Mapper.Map <Comment>(comment); _commentRepo.Add(dbPost); }
public void EditComment(CreateCommentViewDto post) { var dbPost = Mapper.Map <Comment>(post); _commentRepo.Update(dbPost); }