Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,StudentId,Dob,Status,Gender,ClassesId,CreateDate,UpdateDate")] Students students)
        {
            if (id != students.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(students);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentsExists(students.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClassesId"] = new SelectList(_context.Classes, "Id", "Id", students.ClassesId);
            return(View(students));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, Grades grades)
        {
            if (id != grades.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(grades);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GradesExists(grades.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(grades));
        }
Exemple #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,GradesId,CreateDate,UpdateDate")] Classes classes)
        {
            if (id != classes.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(classes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClassesExists(classes.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GradesId"] = new SelectList(_context.Grades, "Id", "Id", classes.GradesId);
            return(View(classes));
        }