public async Task <IActionResult> Create([Bind("Id,Value,DateOfTransaction,CustomerId,SaleSourceId")] Sale sale) { if (ModelState.IsValid) { _context.Add(sale); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["SaleSourceId"] = new SelectList(_context.SaleSource, "Id", "Source", sale.SaleSourceId); return(View(sale)); }
public async Task <IActionResult> Create([Bind("Id,DateOfTransaction,Value,SupplierId")] Purchase purchase) { if (ModelState.IsValid) { _context.Add(purchase); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["SupplierId"] = new SelectList(_context.Supplier, "Id", "Id", purchase.SupplierId); return(View(purchase)); }