public ActionResult Create(FoodItem fooditem) { if (ModelState.IsValid) { _foodItemService.CreateFoodItem(fooditem); return RedirectToAction("Index"); } ViewBag.FoodCategoryId = new SelectList(_foodItemService.GetFoodItem().ToList(), "FoodCategoryId", "Name", fooditem.FoodCategoryId); ViewBag.OfferTypeId = new SelectList(_offerTypeService.GetOfferType(), "OfferTypeId", "Name", fooditem.OfferTypeId); return View(_foodItemModel.GetModel(fooditem)); }
public FoodItemModel GetModel(FoodItem entity) { return new FoodItemModel() { FoodItemId = entity.FoodItemId, Name = entity.Name, FoodCategoryId = entity.FoodCategoryId, PricePerUnit = entity.PricePerUnit, QunatityOnHand = entity.QunatityOnHand, Description = entity.Description, OfferedDiscount = entity.OfferedDiscount, OfferTypeId = entity.OfferTypeId, }; }
public void UpdateFoodItem(FoodItem FoodItem) { _FoodItemRepository.Update(FoodItem); _unitOfWork.Commit(); }
public void CreateFoodItem(FoodItem FoodItem) { _FoodItemRepository.Add(FoodItem); _unitOfWork.Commit(); }