Пример #1
0
 public ActionResult AddFeedRatio(FeedingRatioView model)
 {
     if (ModelState.IsValid)
     {
         _ratio.AddFeedRatio(model);
         return(RedirectToAction("GetAllFeedRatio"));
     }
     return(View());
 }
Пример #2
0
 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;
     }
 }
Пример #4
0
        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 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();
            }
        }
Пример #6
0
 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();
 }