// GET: Catalog/Delete/5 public ActionResult Delete(long catalogId) { if (!_catalogService.ContainsSubCatalogs(catalogId)) { _catalogService.RemoveCatalog(catalogId); } return(RedirectToAction("Index", "Catalog")); }
// GET: Catalog/Delete/5 public ActionResult Delete(long?catalogId) { if (catalogId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var id = catalogId.GetValueOrDefault(); var catalog = db.Catalogs.Find(id); if (catalog == null) { return(HttpNotFound()); } if (!_catalogService.ContainsSubCatalogs(id)) { _catalogService.RemoveCatalog(id); } return(RedirectToAction("Index", "Catalog")); }