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

                return(RedirectToAction(nameof(Index)));
            }
            return(View(admin));
        }
        public async Task <IActionResult> Create([Bind("IdUser,Username,Password")] AccountUser accountUser)
        {
            if (ModelState.IsValid)
            {
                _context.Add(accountUser);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(accountUser));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("NamaIbu,NamaAyah,Pekerjaan,PendapatanAyah,PendapatanIbu,Password,IdUser,IdParent")] Parent parent)
        {
            if (ModelState.IsValid)
            {
                _context.Add(parent);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdUser"] = new SelectList(_context.AccountUser, "IdUser", "IdUser", parent.IdUser);
            return(View(parent));
        }
        public async Task <IActionResult> Create([Bind("Nis,NamaStudent,Kelas,Angkatan,Gender,Alamat,Password,IdUser,IdParent")] Student student)
        {
            if (ModelState.IsValid)
            {
                _context.Add(student);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdParent"] = new SelectList(_context.Parent, "IdParent", "IdParent", student.IdParent);
            ViewData["IdUser"]   = new SelectList(_context.AccountUser, "IdUser", "IdUser", student.IdUser);
            return(View(student));
        }