public ActionResult DeleteComment(int?commentId) { Comment comment = _commentRepo.FindComment(commentId); if (comment == null) { return(HttpNotFound()); } if ((comment.UserId == User.Identity.GetUserId()) || User.IsInRole("Admin")) { try { _commentRepo.DeleteComment(comment); _commentRepo.SaveChanges(); TempData["scrollId"] = "commentContent"; return(Redirect(Request.UrlReferrer.ToString())); } catch (Exception e) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } } return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); }