public async Task <IActionResult> Edit(int id, [Bind("ID, Name, SKU, Price, Description, ImgUrl")] Product product) { if (id != product.ID) { return(RedirectToAction("ViewAll")); } if (ModelState.IsValid) { try { await _robotoRepo.UpdateProduct(id, product); } catch (DbUpdateConcurrencyException) {//prevents a double post in case a product is getting posted at the same time if (!ProductExistsAsync(product.ID).Result) { return(RedirectToAction("ViewAll")); } throw; } return(RedirectToAction("ViewAll")); } return(View(product)); }