public ActionResult AddComment(int idRequest, string comment) { if (comment == null) { return(RedirectToAction("BadRequestError", "Home", new { message = "Нельзя добавить пустой комментарий" })); } var request = _requestService.GetRequestById(idRequest); if (!_securityService.CanComment(request)) { return(RedirectToAction("ForbiddenError", "Home")); } try { _requestService.AddComment(idRequest, comment); _requestService.SaveChanges(); } catch (DbUpdateException e) { return(RedirectToAction("ConflictError", "Home", new { message = ExceptionHelper.RollToInnerException(e).Message })); } return(PartialView("Request/ExtCommentsList", _requestService.GetRequestExtComments(idRequest))); }