public async Task <IActionResult> Edit(int id, [Bind("ID,BankNoteAccountLutState,BankNoteID,AccountID")] VoucherAccountLut voucherAccountLut) { if (id != voucherAccountLut.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(voucherAccountLut); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VoucherAccountLutExists(voucherAccountLut.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AccountID"] = new SelectList(_context.Account, "ID", "ID", voucherAccountLut.AccountID); ViewData["BankNoteID"] = new SelectList(_context.Voucher, "ID", "ID", voucherAccountLut.BankNoteID); return(View(voucherAccountLut)); }
public async Task <IActionResult> Create([Bind("ID,BankNoteAccountLutState,BankNoteID,AccountID")] VoucherAccountLut voucherAccountLut) { if (ModelState.IsValid) { _context.Add(voucherAccountLut); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AccountID"] = new SelectList(_context.Account, "ID", "ID", voucherAccountLut.AccountID); ViewData["BankNoteID"] = new SelectList(_context.Voucher, "ID", "ID", voucherAccountLut.BankNoteID); return(View(voucherAccountLut)); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } VoucherAccountLut = await _context.VoucherAccountLut .Include(v => v.Account) .Include(v => v.BankNote).FirstOrDefaultAsync(m => m.Id == id); if (VoucherAccountLut == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } VoucherAccountLut = await _context.VoucherAccountLut.FindAsync(id); if (VoucherAccountLut != null) { _context.VoucherAccountLut.Remove(VoucherAccountLut); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } VoucherAccountLut = await _context.VoucherAccountLut .Include(v => v.Account) .Include(v => v.BankNote).FirstOrDefaultAsync(m => m.Id == id); if (VoucherAccountLut == null) { return(NotFound()); } ViewData["AccountID"] = new SelectList(_context.Account, "Id", "Id"); ViewData["BankNoteID"] = new SelectList(_context.Voucher, "Id", "Id"); return(Page()); }