Exemplo n.º 1
0
        public ActionResult EditTypeOfFood(TypeOfFood typeOfFoodToUpdate)
        {
            TypeOfFood.Validate(typeOfFoodToUpdate, ModelState);

            if (!ModelState.IsValid)
            {
                return(View(typeOfFoodToUpdate));
            }

            _unitOfWork.TypeOfFoodRepository.Update(typeOfFoodToUpdate);
            _unitOfWork.Save();

            return(RedirectToAction("TypeOfFoods"));
        }
Exemplo n.º 2
0
        public ActionResult AddTypeOfFood(TypeOfFood newTypeOfFood)
        {
            TypeOfFood.Validate(newTypeOfFood, ModelState);

            if (!ModelState.IsValid)
            {
                return(View(newTypeOfFood));
            }

            _unitOfWork.TypeOfFoodRepository.Insert(newTypeOfFood);
            _unitOfWork.Save();

            return(RedirectToAction("TypeOfFoods"));
        }