public ActionResult Add(IngredientsModelView model)
 {
     if (ModelState.IsValid)
     {
         _ingredients.Add(model);
         return(RedirectToAction("RatioManagement", "TreatmentRatioManagement"));
     }
     return(View(model));
 }
 public ActionResult AddIngredient(IngredientsModelView model)
 {
     if (ModelState.IsValid)
     {
         _ingredients.Add(model);
         return(RedirectToAction("GetAllIngredients"));
     }
     return(View(model));
 }
Exemple #3
0
 public void Add(IngredientsModelView model)
 {
     using (var ingredient = new IngredientsRepository())
     {
         var treat = new TreatmentIngredients
         {
             IngredientId    = model.IngredientId,
             IngredientName  = model.IngredientName,
             NumIngredients  = model.NumIngredients,
             IngredientMass  = model.IngredientMass,
             Ingredientprice = model.Ingredientprice,
             TotalPrice      = model.Ingredientprice * model.NumIngredients,
             TotalMass       = model.IngredientMass * model.NumIngredients
         };
         ingredient.Insert(treat);
     }
 }