예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("CourseId,InstructorId,TermId")] TeachingAssignment teachingAssignment)
        {
            if (id != teachingAssignment.CourseId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(teachingAssignment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TeachingAssignmentExists(teachingAssignment.CourseId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseId"]     = new SelectList(_context.Courses, "CourseId", "CourseId", teachingAssignment.CourseId);
            ViewData["InstructorId"] = new SelectList(_context.Instructor, "InstructorId", "InstructorId", teachingAssignment.InstructorId);
            ViewData["TermId"]       = new SelectList(_context.StudyTerm, "TermId", "TermId", teachingAssignment.TermId);
            return(View(teachingAssignment));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("StudentId,CourseId,TermId")] Registration registration)
        {
            if (id != registration.StudentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(registration);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RegistrationExists(registration.StudentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseId"]  = new SelectList(_context.Courses, "CourseId", "CourseId", registration.CourseId);
            ViewData["StudentId"] = new SelectList(_context.Student, "StudentId", "StudentId", registration.StudentId);
            ViewData["TermId"]    = new SelectList(_context.StudyTerm, "TermId", "TermId", registration.TermId);
            return(View(registration));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("DepartmentId,DepartmentName")] Department department)
        {
            if (id != department.DepartmentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(department);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DepartmentExists(department.DepartmentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(department));
        }
예제 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("CourseId,CourseName,DepartmentId")] Courses courses)
        {
            if (id != courses.CourseId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(courses);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CoursesExists(courses.CourseId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DepartmentId"] = new SelectList(_context.Department, "DepartmentId", "DepartmentId", courses.DepartmentId);
            return(View(courses));
        }
예제 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("StudentId,StudentFirstName,StudentLastName,StudentEnrollment,StudentPhone")] Student student)
        {
            if (id != student.StudentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(student);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentExists(student.StudentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
예제 #6
0
        public async Task <IActionResult> Edit(int id, [Bind("InstructorId,InstructorFirstName,InstructorLastName,InstructorPhone,InstructorHireDepartment")] Instructor instructor)
        {
            if (id != instructor.InstructorId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(instructor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InstructorExists(instructor.InstructorId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(instructor));
        }
예제 #7
0
        public async Task <IActionResult> Edit(int id, [Bind("TermId,TermName,TermStartDate,TermEndDate,TermYear,TermSeason")] StudyTerm studyTerm)
        {
            if (id != studyTerm.TermId)
            {
                return(NotFound());
            }

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