示例#1
0
        public async Task <IActionResult> Create([Bind("DepartmentId,DepartmentName")] Department department)
        {
            if (ModelState.IsValid)
            {
                _context.Add(department);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(department));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("StudentId,StudentFirstName,StudentLastName,StudentEnrollment,StudentPhone")] Student student)
        {
            if (ModelState.IsValid)
            {
                _context.Add(student);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
示例#3
0
        public async Task <IActionResult> Create([Bind("InstructorId,InstructorFirstName,InstructorLastName,InstructorPhone,InstructorHireDepartment")] Instructor instructor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(instructor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(instructor));
        }
示例#4
0
        public async Task <IActionResult> Create([Bind("TermId,TermName,TermStartDate,TermEndDate,TermYear,TermSeason")] StudyTerm studyTerm)
        {
            if (ModelState.IsValid)
            {
                _context.Add(studyTerm);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(studyTerm));
        }
示例#5
0
        public async Task <IActionResult> Create([Bind("CourseId,CourseName,DepartmentId")] Courses courses)
        {
            if (ModelState.IsValid)
            {
                _context.Add(courses);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DepartmentId"] = new SelectList(_context.Department, "DepartmentId", "DepartmentId", courses.DepartmentId);
            return(View(courses));
        }
示例#6
0
        public async Task <IActionResult> Create([Bind("StudentId,CourseId,TermId")] Registration registration)
        {
            if (ModelState.IsValid)
            {
                _context.Add(registration);
                await _context.SaveChangesAsync();

                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));
        }
示例#7
0
        public async Task <IActionResult> Create([Bind("CourseId,InstructorId,TermId")] TeachingAssignment teachingAssignment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(teachingAssignment);
                await _context.SaveChangesAsync();

                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));
        }