public ActionResult Edit(int?id) { var userId = User.Identity.GetUserId(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Project project = db.Projects.Find(id); if (project == null) { return(HttpNotFound()); } if (DecisionHelper.ProjectIsEditableByUser(project)) { return(View(project)); } return(RedirectToAction("AccessViolation, Admin")); }