public async Task <IActionResult> Create([Bind("Id,Name,Score,FriendCount,IsGettingTuition,Status,BirthDay")] Student student)
        {
            if (ModelState.IsValid)
            {
                _context.Add(student);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Course course)
        {
            if (ModelState.IsValid)
            {
                _context.Add(course);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(course));
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("Id,Name,CourseId")] Subject subject)
        {
            if (ModelState.IsValid)
            {
                _context.Add(subject);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseId"] = new SelectList(_context.Courses, "Id", "Name", subject.CourseId);
            return(View(subject));
        }
Beispiel #4
0
        public async Task <IActionResult> Create([Bind("Id,StudentId,SubjectId,Score")] StudentSubject studentSubject)
        {
            if (ModelState.IsValid)
            {
                _context.Add(studentSubject);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StudentId"] = new SelectList(_context.Students, "Id", "Name", studentSubject.StudentId);
            ViewData["SubjectId"] = new SelectList(_context.Subjects, "Id", "Name", studentSubject.SubjectId);



            return(View(studentSubject));
        }