public ActionResult AddFeedRatio(FeedingRatioView model) { if (ModelState.IsValid) { _ratio.AddFeedRatio(model); return(RedirectToAction("GetAllFeedRatio")); } return(View()); }
public FeedingRatioView GetFeedRatioById(int id) { using (var feedRatio = new FeedingRatioRepository()) { var feed = feedRatio.GetById(id); var feedView = new FeedingRatioView(); if (feed != null) { feedView.FeedingRatioId = feed.FeedingRatioId; feedView.ProductMass = feed.ProductMass; feedView.ProductName = feed.ProductName; } return(feedView); } }
public FeedingRatioView GetFeedRatioById(int id) { using (var feedRatio = new FeedingRatioRepository()) { var feed = feedRatio.GetById(id); var feedView = new FeedingRatioView(); if (feed != null) { feedView.FeedingRatioId = feed.FeedingRatioId; feedView.ProductMass = feed.ProductMass; feedView.ProductName = feed.ProductName; } return feedView; } }
public void AddFeedRatio(FeedingRatioView model) { using (var feedRatio = new FeedingRatioRepository()) { //from ingredients double totalIngredientsMass = _ingredients.GetAll().Sum(x => Convert.ToDouble(x.IngredientMass)); var feed = new FeedingRatio { FeedingRatioId = model.FeedingRatioId, ProductName = model.ProductName, ProductMass = totalIngredientsMass.ToString(CultureInfo.InvariantCulture) + " Kg." }; feedRatio.Insert(feed); DeleteAllIngredientsFromList(); } }
public ActionResult DeleteFeedRatio(FeedingRatioView model) { return(View()); }
public ActionResult AddFeedRatio(FeedingRatioView model) { if (ModelState.IsValid) { _ratio.AddFeedRatio(model); return RedirectToAction("GetAllFeedRatio"); } return View(); }
public ActionResult UpdateFeedRatio(FeedingRatioView model) { return View(); }