예제 #1
0
        public async Task <IActionResult> Create([Bind("CourseId,CourseName")] Courses courses)
        {
            if (ModelState.IsValid)
            {
                _context.Add(courses);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(courses));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("TeacherId,Name")] Teachers teachers)
        {
            if (ModelState.IsValid)
            {
                _context.Add(teachers);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(teachers));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("UserId,Password,JobTitle")] Users users)
        {
            if (ModelState.IsValid)
            {
                _context.Add(users);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(users));
        }
예제 #4
0
        public async Task <IActionResult> Create([Bind("CourseId,TeacherId,AssignmentDate")] CourseAssignment courseAssignment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(courseAssignment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseId"]  = new SelectList(_context.Courses, "CourseId", "CourseId", courseAssignment.CourseId);
            ViewData["TeacherId"] = new SelectList(_context.Teachers, "TeacherId", "TeacherId", courseAssignment.TeacherId);
            return(View(courseAssignment));
        }