public async Task <IActionResult> Edit(int id, [Bind("IdTransaksi,NotaPembayaran,IdKasir,IdPelanggan")] Membayar membayar) { if (id != membayar.IdTransaksi) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(membayar); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MembayarExists(membayar.IdTransaksi)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IdKasir"] = new SelectList(_context.Kasir, "IdKasir", "IdKasir", membayar.IdKasir); ViewData["IdPelanggan"] = new SelectList(_context.Pelanggan, "IdPelanggan", "IdPelanggan", membayar.IdPelanggan); return(View(membayar)); }
public async Task <IActionResult> Create([Bind("IdTransaksi,NotaPembayaran,IdKasir,IdPelanggan")] Membayar membayar) { if (ModelState.IsValid) { _context.Add(membayar); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdKasir"] = new SelectList(_context.Kasir, "IdKasir", "IdKasir", membayar.IdKasir); ViewData["IdPelanggan"] = new SelectList(_context.Pelanggan, "IdPelanggan", "IdPelanggan", membayar.IdPelanggan); return(View(membayar)); }