public void AddComment(CommentModel commentModel) { var date = dateService.GetCurrentDate(); var comment = new Comment { Date = date, IsInternal = commentModel.IsInternal, RequestId = commentModel.RequestId, Text = commentModel.Text, UserProfileId = commentModel.AuthorId }; commentRepository.CreateComment(comment); }
public ActionResult LeaveComment(int requestId, PostCommentVM commentVM) { var currentUserId = CurrentUser.UserId; var commentModel = new CommentModel { AuthorId = currentUserId, IsInternal = commentVM.IsInternal == true.ToString(), Text = commentVM.Text, RequestId = commentVM.requestId }; if (!String.IsNullOrWhiteSpace(commentModel.Text)) { commentService.AddComment(commentModel); } if (User.IsInRole("Client")) { return RedirectToAction("ClientDetails", "Request", new {requestId = commentModel.RequestId}); } return RedirectToAction("EmployeeDetails", "Request", new {requestId = commentModel.RequestId}); }