public ActionResult DeleteConfirmed(int id) { CanteenCategory canteenCategory = db.CanteenCategories.Find(id); db.CanteenCategories.Remove(canteenCategory); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "CanteenCategoryId,Value")] CanteenCategory canteenCategory) { if (ModelState.IsValid) { db.Entry(canteenCategory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(canteenCategory)); }
public ActionResult Create([Bind(Include = "CanteenCategoryId,Value")] CanteenCategory canteenCategory) { if (ModelState.IsValid) { db.CanteenCategories.Add(canteenCategory); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(canteenCategory)); }
// GET: Admin/CanteenCategories/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CanteenCategory canteenCategory = db.CanteenCategories.Find(id); if (canteenCategory == null) { return(HttpNotFound()); } return(View(canteenCategory)); }