Esempio n. 1
0
 public void UpdateFoodandMedicine(FoodandMedicine foodandMedicine)
 {
     using (var context = new EAContext())
     {
         context.Entry(foodandMedicine).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
Esempio n. 2
0
        public void CreateFoodandMedicine(FoodandMedicine foodandMedicine)
        {
            using (var context = new EAContext())
            {
                context.Entry(foodandMedicine.Category).State = EntityState.Unchanged;

                context.FoodandMedicines.Add(foodandMedicine);
                context.SaveChanges();
            }
        }
Esempio n. 3
0
        public ActionResult Create(NewFoodandMedicinesViewModel model)
        {
            var newFoodChart = new FoodandMedicine();

            newFoodChart.Month     = model.Month;
            newFoodChart.MinWeight = model.MinWeight;
            newFoodChart.MaxWeight = model.MaxWeight;
            newFoodChart.Food      = model.Food;
            newFoodChart.Medicine  = model.Medicine;
            newFoodChart.Category  = CategoryService.Instance.GetCategory(model.CategoryID);


            foodandMedicineService.CreateFoodandMedicine(newFoodChart);
            //return View();
            return(RedirectToAction("FoodandMedicineTable"));
        }