コード例 #1
0
        public ActionResult Edit(EditFoodandMedicinesViewModel model)
        {
            var existingFood = foodandMedicineService.GetFoodandMedicine(model.ID);

            existingFood.Month     = model.Month;
            existingFood.MinWeight = model.MinWeight;
            existingFood.MaxWeight = model.MaxWeight;
            existingFood.Food      = model.Food;
            existingFood.Medicine  = model.Medicine;
            foodandMedicineService.UpdateFoodandMedicine(existingFood);
            return(RedirectToAction("FoodandMedicineTable"));
        }
コード例 #2
0
        public ActionResult Edit(int ID)
        {
            EditFoodandMedicinesViewModel model = new EditFoodandMedicinesViewModel();
            var food = foodandMedicineService.GetFoodandMedicine(ID);

            model.ID        = food.ID;
            model.Month     = food.Month;
            model.MinWeight = food.MinWeight;
            model.MaxWeight = food.MaxWeight;
            model.Food      = food.Food;
            model.Medicine  = food.Medicine;
            return(PartialView(model));
        }