Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Email,Password,CreateAt,UpdateAt,Status")] Account account)
        {
            if (id != account.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(account);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AccountExists(account.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(account));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Theory,Practice,Assignment,CreatedAt,UpdateAt")] Mark mark)
        {
            if (id != mark.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(mark);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MarkExists(mark.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Id"] = new SelectList(_context.Set <Subject>(), "Id", "Id", mark.Id);
            return(View(mark));
        }
        public async Task <IActionResult> Edit(int id, [Bind("AccountId,ClassId,FirstName,LastName,Phone,Address,BirthDay,CreateAt,UpdateAt")] StudentInformation studentInformation)
        {
            if (id != studentInformation.AccountId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(studentInformation);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentInformationExists(studentInformation.AccountId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AccountId"] = new SelectList(_context.Account, "Id", "Id", studentInformation.AccountId);
            ViewData["ClassId"]   = new SelectList(_context.Classroom, "Id", "Id", studentInformation.ClassId);
            return(View(studentInformation));
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,CreatedAt,UpdateAt")] Subject subject)
        {
            if (id != subject.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(subject);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SubjectExists(subject.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(subject));
        }
Esempio n. 5
0
        public async Task<IActionResult> Edit(int id, [Bind("Id,Name,CreatedAt,UpdatedAt")] Classroom classroom)
        {
            if (id != classroom.Id)
            {
                return NotFound();
            }

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