public async Task <IActionResult> Create(int itemOfProductId) { var itemOfProduct = await _repository.GetItemOfProduct(itemOfProductId); if (itemOfProduct == null) { ViewBag.ErrorMessage = "لايوجد بيانات"; return(View("NotFound")); } ViewBag.ItemOfProductId = itemOfProduct.Id; ViewBag.ItemOfProductName = itemOfProduct.Name; return(View()); }
public async Task <IActionResult> Edit(int id) { var itemOfProduct = await _repository.GetItemOfProduct(id); if (itemOfProduct == null) { ViewBag.ErrorMessage = "لايوجد بيانات"; return(View("NotFound")); } ViewData["TypeOfProductId"] = new SelectList(await _repository.GetTypeOfProducts(), "Id", "Name", itemOfProduct.Id); return(View(itemOfProduct)); }