public IActionResult Delete(int id) { int userId = int.Parse(HttpContext.User.FindFirstValue("Id")); Answer a = _answersService.GetOne(id); try { if (!string.IsNullOrEmpty(a.Image)) { _storageService.Delete(a.Image); } _commentsService.DeleteAll(userId, ICommentsService.CommentType.Answer, id); _answersService.Delete(userId, a.Id); } catch (AskMateNotAuthorizedException) { return(Forbid()); } return(Redirect(Request.Headers["Referer"])); }