public static ExtrasAndTopping AddExtra(ExtrasAndTopping extra) { var result = db.ExtrasAndToppings.Add(extra); db.SaveChanges(); return(result); }
public static void UpdateExtrasPrices(ExtrasAndTopping itemPrices) { ExtrasAndTopping Updated = db.ExtrasAndToppings.Find(itemPrices.Id); Updated.Price1 = itemPrices.Price1; Updated.Price2 = itemPrices.Price2; Updated.Price3 = itemPrices.Price3; db.Entry(Updated).State = EntityState.Modified; db.SaveChanges(); }
public JsonResult AddExrtaItem(ExtrasAndTopping extra) { if (extra == null) { return(Json("Erro : Invalid Data Added", JsonRequestBehavior.AllowGet)); } else { var Item = DAC.AddExtra(extra); return(Json(Item, JsonRequestBehavior.AllowGet)); } }
public JsonResult EditExtra(ExtrasAndTopping extraItem) { if (extraItem != null) { DAC.UpdateExtrasItem(extraItem); return(Json("Item Updated", JsonRequestBehavior.AllowGet)); } else { return(Json("No Value Passed", JsonRequestBehavior.AllowGet)); } }
public static void UpdateExtrasItem(ExtrasAndTopping UpdatedItem) { var item = db.ExtrasAndToppings.FirstOrDefault(m => m.Id == UpdatedItem.Id); if (item != null) { item.Title = UpdatedItem.Title; db.Entry(item).State = EntityState.Modified; db.SaveChanges(); } }
public JsonResult UpdateExtrasPrices(PriceModel prices) { if (prices != null) { ExtrasAndTopping item = new ExtrasAndTopping() { Id = prices.ItemId, Price1 = prices.price1, Price2 = prices.price2, Price3 = prices.price3 }; DAC.UpdateExtrasPrices(item); return(Json("Updated Successfully", JsonRequestBehavior.AllowGet)); } else { return(Json("Invalid Information Entered", JsonRequestBehavior.AllowGet)); } }