public ActionResult AddFood(Food obj) { MvcCrudEntities contex = new MvcCrudEntities(); contex.customers.Add(new customer() { id = obj.id, name = obj.name, category = obj.category, price = obj.price }); contex.SaveChanges(); return(View("AddFood", obj)); }
public ActionResult EditRecord(customer obj) { MvcCrudEntities contex = new MvcCrudEntities(); var editRecords = (from item in contex.customers where item.id == obj.id select item).First(); editRecords.name = obj.name; editRecords.category = obj.category; editRecords.price = obj.price; contex.SaveChanges(); var Records = contex.customers.ToList(); return(View("ShowRecords", Records)); }