public ActionResult AddNewIngredient(IndexIngredientsToNotify inxObj) { if (ModelState.IsValid) { // db.Entry(person).State = EntityState.Modified; var exist = GetIngredientsToCalculate().linesIngr.Where(x => x.IngredientDishName == inxObj.IngredientDishName).ToList(); if (exist.Count() == 0 ) { GetIngredientsToCalculate().linesIngr.Add(inxObj); } return Json(new { success = true }); } ViewBag.UnitMeasure = new SelectList(db.Units, "Name", "Name"); return PartialView("_AddNewIngredient", inxObj); }
public void UpdateItem(IndexIngredientsToNotify ingredient) { //RemoveIngredient(ingredient.IngredientDishId); // AddItem(ingredient); var a = linesIngr.Where(x=> x.IngredientDishId == ingredient.IngredientDishId).FirstOrDefault(); a.TotalRequired = ingredient.TotalRequired; }
public ActionResult UpdateTotalRequired(IndexIngredientsToNotify inxObj) { if (ModelState.IsValid) { // db.Entry(person).State = EntityState.Modified; GetIngredientsToCalculate().UpdateItem(inxObj); return Json(new { success = true }); } return PartialView("_UpdateTotalRequired", inxObj); }