public ActionResult EditTypeOfFood(TypeOfFood typeOfFoodToUpdate) { TypeOfFood.Validate(typeOfFoodToUpdate, ModelState); if (!ModelState.IsValid) { return(View(typeOfFoodToUpdate)); } _unitOfWork.TypeOfFoodRepository.Update(typeOfFoodToUpdate); _unitOfWork.Save(); return(RedirectToAction("TypeOfFoods")); }
public ActionResult AddTypeOfFood(TypeOfFood newTypeOfFood) { TypeOfFood.Validate(newTypeOfFood, ModelState); if (!ModelState.IsValid) { return(View(newTypeOfFood)); } _unitOfWork.TypeOfFoodRepository.Insert(newTypeOfFood); _unitOfWork.Save(); return(RedirectToAction("TypeOfFoods")); }