Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("NamaIbu,NamaAyah,Pekerjaan,PendapatanAyah,PendapatanIbu,Password,IdUser,IdParent")] Parent parent)
        {
            if (id != parent.IdParent)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(parent);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ParentExists(parent.IdParent))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdUser"] = new SelectList(_context.AccountUser, "IdUser", "IdUser", parent.IdUser);
            return(View(parent));
        }
        public async Task <IActionResult> Edit(string id, [Bind("IdAdmin,NamaAdmin,Password")] 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));
        }
        public async Task <IActionResult> Edit(string id, [Bind("Nis,NamaStudent,Kelas,Angkatan,Gender,Alamat,Password,IdUser,IdParent")] Student student)
        {
            if (id != student.Nis)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(student);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentExists(student.Nis))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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));
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdUser,Username,Password")] AccountUser accountUser)
        {
            if (id != accountUser.IdUser)
            {
                return(NotFound());
            }

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