public ActionResult Edit(FoodCategory foodcategory)
 {
     if (ModelState.IsValid)
     {
         _foodCategoryService.UpdateFoodCategory(foodcategory);
         return RedirectToAction("Index");
     }
     return View(_foodCategoryModel.GetModel(foodcategory));
 }
Ejemplo n.º 2
0
 public FoodCategoryModel GetModel(FoodCategory entity)
 {
     return new FoodCategoryModel
     {
         FoodCategoryId = entity.FoodCategoryId,
         Name = entity.Name,
         Unit = entity.Unit,
         Description = entity.Description,
     };
 }
 public void UpdateFoodCategory(FoodCategory foodCategory)
 {
     _foodCategoryRepository.Update(foodCategory);
     _unitOfWork.Commit();
 }
 public void CreateFoodCategory(FoodCategory foodCategory)
 {
     _foodCategoryRepository.Add(foodCategory);
     _unitOfWork.Commit();
 }