// GET: ProductItem/Edit/5 public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } var productItem = await _productItemRepository.GetAsync(id.Value); if (productItem == null) { return(NotFound()); } ViewData["ProductId"] = new SelectList(_productItemRepository.Query(), "ProductId", "Code", productItem.ProductId); return(View(productItem)); }