public ActionResult Delete(string sID) { ModelProductCategory cItemToDelete = cRepository.Find(sID); if (cItemToDelete == null) { return(HttpNotFound()); } else { return(View(cItemToDelete)); } }
public ActionResult Create(ModelProductCategory cItem) { if (!ModelState.IsValid) { return(View(cItem)); } else { cRepository.Insert(cItem); cRepository.Commit(); return(RedirectToAction("Index")); } }
public ActionResult ConfirmDelete(string sID) { ModelProductCategory cItemToDelete = cRepository.Find(sID); if (cItemToDelete == null) { return(HttpNotFound()); } else { cRepository.Delete(sID); cRepository.Commit(); return(RedirectToAction("Index")); } }
public ActionResult Edit(ModelProductCategory cItem, string sID) { ModelProductCategory cItemToEdit = cRepository.Find(sID); if (cItemToEdit == null) { return(HttpNotFound()); } else { if (!ModelState.IsValid) { return(View(cItemToEdit)); } cItemToEdit.Category = cItem.Category; cRepository.Commit(); return(RedirectToAction("Index")); } }
public ActionResult Create() { ModelProductCategory cItem = new ModelProductCategory(); return(View(cItem)); }