public async Task <IActionResult> Edit(int id, [Bind("Id,Value,DateOfTransaction,CustomerId,SaleSourceId")] Sale sale) { if (id != sale.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(sale); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SaleExists(sale.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["SaleSourceId"] = new SelectList(_context.SaleSource, "Id", "Source", sale.SaleSourceId); return(View(sale)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,DateOfTransaction,Value,SupplierId")] Purchase purchase) { if (id != purchase.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(purchase); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PurchaseExists(purchase.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["SupplierId"] = new SelectList(_context.Supplier, "Id", "Id", purchase.SupplierId); return(View(purchase)); }