public async Task <IActionResult> PutStudents(int id, Students students)
        {
            if (id != students.Id)
            {
                return(BadRequest());
            }

            _context.Entry(students).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StudentsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#2
0
        public async Task <IActionResult> EditStudent(Student student)
        {
            db.Students.Update(student);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }