public ActionResult DeleteConfirmed(int id) { DishesType dishesTypes = db.DishesTypes.Find(id); db.DishesTypes.Remove(dishesTypes); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,Type")] DishesType dishesTypes) { if (ModelState.IsValid) { db.Entry(dishesTypes).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(dishesTypes)); }
public ActionResult Create([Bind(Include = "ID,Type")] DishesType dishesTypes) { if (ModelState.IsValid) { db.DishesTypes.Add(dishesTypes); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(dishesTypes)); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DishesType dishesTypes = db.DishesTypes.Find(id); if (dishesTypes == null) { return(HttpNotFound()); } return(View(dishesTypes)); }
public MenuBuilder AddDishes(DishesType type, string description, int limit = 0) { if (Menu.Dishes.Any(x => x.Type == type)) { throw new Exception($"Menu type '{type}' already exists."); } Menu.Dishes.Add(new MenuDishes { Description = description, Type = type, HasLimit = limit > 0, Limit = limit }); return(this); }
public Form2(DishesType dish) { this.dish = dish; InitializeComponent(); }