Esempio n. 1
0
        internal Ingredient Edit(Ingredient updated)
        {
            var data = GetById(updated.Id);

            updated.Title    = updated.Title != null ? updated.Title : data.Title;
            updated.Quantity = updated.Quantity != 0 ? updated.Quantity : data.Quantity;
            return(_repo.Edit(updated));
        }
Esempio n. 2
0
        public Ingredient Edit(Ingredient editIngredient)
        {
            Ingredient original = Get(editIngredient.Id);

            original.Name = editIngredient.Name.Length > 0 ? editIngredient.Name : original.Name;
            original.KCal = editIngredient.KCal > 0 ? editIngredient.KCal : original.KCal;
            return(_repo.Edit(original));
        }
 public ActionResult Edit([Bind(Include = "Id,Name,Quantity,Receipts_Id")] Ingredient ingredient)
 {
     if (ModelState.IsValid)
     {
         IngredientRepo.Edit(ingredient);
         return(RedirectToAction("Index"));
     }
     return(View(ingredient));
 }
Esempio n. 4
0
        public ActionResult EditIngredient(Models.ViewModel.Ingredient i)
        {
            bool success = iRepo.Edit(i);

            if (success)
            {
                ViewBag.message = "Successful!";
            }
            else
            {
                ViewBag.message = "Something went wrong!";
            }
            return(RedirectToAction("Ingredients"));
        }
Esempio n. 5
0
 internal object Edit(Ingredient editIngredient)
 {
     return(_repo.Edit(editIngredient));
 }