Пример #1
0
 public ActionResult Delete(int? id)
 {
     int ID = id ?? 0;
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     Category category;
     using (Repos repo = new Repos())
     {
         category = repo.GetCategoryByID(ID);
     }
     if (category == null)
     {
         return HttpNotFound();
     }
     return View(category);
 }
Пример #2
0
 public ActionResult DeleteConfirmed(int id)
 {
     Category category;
     using (Repos repo = new Repos())
     {
         category = repo.GetCategoryByID(id);
         repo.DeleteCategory(category.CategoryID);
     }
     return RedirectToAction("Index");
 }