public async Task <IActionResult> Edit(int id, [Bind("Id,Source,ShopsId,Quantity")] PaperRollsTransactions paperRollsTransactions) { if (id != paperRollsTransactions.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(paperRollsTransactions); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PaperRollsTransactionsExists(paperRollsTransactions.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ShopsId"] = new SelectList(_context.Shops, "ID", "Name", paperRollsTransactions.ShopsId); return(View(paperRollsTransactions)); }
public async Task <IActionResult> Create([Bind("Id,Source,ShopsId,Quantity")] PaperRollsTransactions paperRollsTransactions) { if (ModelState.IsValid) { _context.Add(paperRollsTransactions); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ShopsId"] = new SelectList(_context.Shops, "ID", "Name", paperRollsTransactions.ShopsId); return(View(paperRollsTransactions)); }