public JsonResult AddMenuItem(ItemMenuV item) { if (item != null) { var menuItemView = new RestaurantMenu() { Id = item._Id, availability = true, category = Convert.ToInt32(item._category), name = item._name, information = item._information, price = item._price, picture = "..\\images\\" + item._picture, novelty = true, hit = false }; db.RestaurantMenu.InsertOnSubmit(menuItemView); db.SubmitChanges(); return(Json("MenuItem ADD OK")); } else { return(Json("Invalid Item")); } }
public string DelMenuItem(ItemMenuV item) { if (item != null) { int no = Convert.ToInt32(item._Id); var MenuItemList = db.RestaurantMenu.Where(x => x.Id == no).FirstOrDefault(); db.RestaurantMenu.DeleteOnSubmit(MenuItemList); db.SubmitChanges(); return("MenuItem Deleted");; } else { return("Invalid MenuItemList"); } }
public JsonResult CheckCheng(ItemMenuV item) { if (item != null) { int no = Convert.ToInt32(item._Id); var menuItemList = db.RestaurantMenu.Where(x => x.Id == no).FirstOrDefault(); menuItemList.availability = item._availability; menuItemList.novelty = item._novelty; menuItemList.hit = item._hit; db.SubmitChanges(); return(Json("MenuItem Updated")); } else { return(Json("Invalid MenuItem")); } }
public JsonResult UpdateMenuItem(ItemMenuV item) { if (item != null) { int no = Convert.ToInt32(item._Id); var menuItemList = db.RestaurantMenu.Where(x => x.Id == no).FirstOrDefault(); menuItemList.category = db.Category.Where(w => w.Id == Convert.ToInt32(item._category)).FirstOrDefault().Id; menuItemList.name = item._name; menuItemList.information = item._information; menuItemList.price = item._price; menuItemList.picture = "..\\images\\" + item._picture; db.SubmitChanges(); return(Json("MenuItem Updated")); } else { return(Json("Invalid MenuItem")); } }