public ActionResult DeleteConfirmed(int id, String UrlReferrer) { Sprint sprint = db.GetSprintById(User, id); if (sprint == null) { return(HttpNotFound()); } if (sprint.ContainsSelectedAction) { //not working nor pending confirmation if (sprint.Owner.WorkingPanelAvailable) { //clear selected action sprint.Owner.ActionID = null; db.Entry(sprint.Owner).State = EntityState.Modified; } else { //cannot perform change return(RedirectToAction("Delete", new { id = id })); } } int projectID = sprint.ProjectID; db.Sprints.Remove(sprint); db.SaveChanges(); TempData["UpdateInfo"] = Settings.MSG_SUCCESSFUL_DELETE; //return Redirect(UrlReferrer); return(RedirectToAction("Details", "Project", new { id = projectID })); }