public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Price,QuantityAvailable,CategoryID")] Product product) { if (id != product.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(product); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(product.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CategoryID"] = new SelectList(_context.Categories, "ID", "Name", product.CategoryID); return(View(product)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,ProductID,QuantityPurchased,SubTotal,DatePurchased,SalesID")] SalesDetail salesDetail) { if (id != salesDetail.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(salesDetail); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SalesDetailExists(salesDetail.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["SalesID"] = new SelectList(_context.Sales, "ID", "ID");//salesDetail.SalesID return(View(salesDetail)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,ProductName,Price,QuanitityPurchased,SubTotal")] MakeSales makeSales) { if (id != makeSales.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(makeSales); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MakeSalesExists(makeSales.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(makeSales)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Description")] Category category) { if (id != category.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,LastName,FirstName,Email,PhoneNo")] Customer customer) { if (id != customer.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer)); }