public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Level,Instructor")] Course course)
        {
            if (id != course.ID)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(course);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CourseExists(course.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                return(RedirectToAction("Index"));
            }

            return(View(course));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,FirstName,LastName,Course")] Student student)
        {
            if (id != student.ID)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(student);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentExists(student.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                return(RedirectToAction("Index"));
            }

            return(View(student));
        }///////////////////////////////////////////