public ActionResult Comment(AddEditCommentModel comment) { if (ModelState.IsValid) { BllComment bllComment = comment.ToBllComment(); bllComment.Sender = userService.GetUser(User.Identity.Name); commentService.AddComment(bllComment); } return(RedirectToAction("Topic", "Home", new { id = comment.TopicId })); }
private ActionResult ChangeCommentState(AddEditCommentModel comment, StatusEnum status) { if (ModelState.IsValid) { BllComment bllComment = comment.ToBllComment(); bllComment.Status = new BllStatus { Id = (int)status }; commentService.UpdateComment(bllComment); return(RedirectToAction("Topic", "Home", new { id = comment.TopicId })); } return(View("EditComment", comment)); }
public static BllComment ToBllComment(this AddEditCommentModel comment) { return(new BllComment { Id = comment.Id, Text = comment.Text, IsAnswer = comment.IsAnswer, Topic = new BllTopic() { Id = comment.TopicId }, }); }
public ActionResult DeleteComment(AddEditCommentModel comment) { commentService.DeleteComment(comment.Id); return(RedirectToAction("Topic", "Home", new { id = comment.TopicId })); }
public ActionResult RejectComment(AddEditCommentModel comment) { return(ChangeCommentState(comment, StatusEnum.Rejected)); }
public ActionResult AcceptComment(AddEditCommentModel comment) { return(ChangeCommentState(comment, StatusEnum.Accepted)); }