示例#1
0
        public async Task <IActionResult> Create([Bind("Pkexam,ExDate,Subject")] Exams exams)
        {
            if (ModelState.IsValid)
            {
                _context.Add(exams);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(exams));
        }
        public async Task <IActionResult> Create([Bind("Pkstudent,Name")] Students students)
        {
            if (ModelState.IsValid)
            {
                _context.Add(students);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(students));
        }
        public async Task <IActionResult> Create([Bind("Ppkfkstudent,Ppkfkexam,Grade")] StudentsExams studentsExams)
        {
            if (ModelState.IsValid)
            {
                _context.Add(studentsExams);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Ppkfkexam"]    = new SelectList(_context.Exams, "Pkexam", "Subject", studentsExams.Ppkfkexam);
            ViewData["Ppkfkstudent"] = new SelectList(_context.Students, "Pkstudent", "Name", studentsExams.Ppkfkstudent);
            return(View(studentsExams));
        }