Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("IdAdmin,NamaAdmin")] Admin admin)
        {
            if (ModelState.IsValid)
            {
                _context.Add(admin);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(admin));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("IdPembeli,NamaPembeli,JenisKelamin,NoTlp,Alamat")] Pembeli pembeli)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pembeli);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pembeli));
        }
        public async Task <IActionResult> Create([Bind("IdStaff,NamaStaff,NoTlp,Alamat")] StaffGudang staffGudang)
        {
            if (ModelState.IsValid)
            {
                _context.Add(staffGudang);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(staffGudang));
        }
        public async Task <IActionResult> Create([Bind("IdTransaksi,IdBarang,IdPembeli,Tanggal,Keterangan")] Transaksi transaksi)
        {
            if (ModelState.IsValid)
            {
                _context.Add(transaksi);
                await _context.SaveChangesAsync();

                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> Create([Bind("IdBarang,NamaBarang,Harga,Stok,IdStaff,IdAdmin,Size")] Barang barang)
        {
            if (ModelState.IsValid)
            {
                _context.Add(barang);
                await _context.SaveChangesAsync();

                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));
        }