public ActionResult Delete(int?id) { if (!id.HasValue) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Material material = m_repo.GetMaterial(id.Value); if (material == null) { return(HttpNotFound()); } m_repo.DeleteMaterial(material); return(RedirectToAction("Index")); }