Пример #1
0
 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 }));
 }
Пример #2
0
 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));
 }
Пример #3
0
 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
         },
     });
 }
Пример #4
0
 public ActionResult DeleteComment(AddEditCommentModel comment)
 {
     commentService.DeleteComment(comment.Id);
     return(RedirectToAction("Topic", "Home", new { id = comment.TopicId }));
 }
Пример #5
0
 public ActionResult RejectComment(AddEditCommentModel comment)
 {
     return(ChangeCommentState(comment, StatusEnum.Rejected));
 }
Пример #6
0
 public ActionResult AcceptComment(AddEditCommentModel comment)
 {
     return(ChangeCommentState(comment, StatusEnum.Accepted));
 }