public async Task <IActionResult> Edit(int id, [Bind("IdTransaksi,IdBarang,IdPembeli,Tanggal,Keterangan")] Transaksi transaksi)
        {
            if (id != transaksi.IdTransaksi)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(transaksi);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TransaksiExists(transaksi.IdTransaksi))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdBarang"]  = new SelectList(_context.Barang, "IdBarang", "IdBarang", transaksi.IdBarang);
            ViewData["IdPembeli"] = new SelectList(_context.Pembeli, "IdPembeli", "IdPembeli", transaksi.IdPembeli);
            return(View(transaksi));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdBarang,NamaBarang,Harga,Stok,IdStaff,IdAdmin,Size")] Barang barang)
        {
            if (id != barang.IdBarang)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(barang);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BarangExists(barang.IdBarang))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdAdmin"] = new SelectList(_context.Admin, "IdAdmin", "IdAdmin", barang.IdAdmin);
            ViewData["IdStaff"] = new SelectList(_context.StaffGudang, "IdStaff", "IdStaff", barang.IdStaff);
            return(View(barang));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(int id, [Bind("IdAdmin,NamaAdmin")] Admin admin)
        {
            if (id != admin.IdAdmin)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(admin);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AdminExists(admin.IdAdmin))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(admin));
        }
Beispiel #4
0
        public async Task <IActionResult> Edit(int id, [Bind("IdPembeli,NamaPembeli,JenisKelamin,NoTlp,Alamat")] Pembeli pembeli)
        {
            if (id != pembeli.IdPembeli)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pembeli);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PembeliExists(pembeli.IdPembeli))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pembeli));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdStaff,NamaStaff,NoTlp,Alamat")] StaffGudang staffGudang)
        {
            if (id != staffGudang.IdStaff)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(staffGudang);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StaffGudangExists(staffGudang.IdStaff))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(staffGudang));
        }