Exemple #1
0
        public async Task <IActionResult> Create([Bind("StudId,Fname,Lname")] Student student)
        {
            if (ModelState.IsValid)
            {
                _context.Add(student);
                await _context.SaveChangesAsync();

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

                return(RedirectToAction(nameof(Index)));
            }
            return(View(course));
        }
        public async Task <IActionResult> Create([Bind("TestId,QuestionId,Answer1,Answer2,Answer3,Answer4,CorrectAnswer,Question")] TestQuestions testQuestions)
        {
            if (ModelState.IsValid)
            {
                _context.Add(testQuestions);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TestId"] = new SelectList(_context.Test, "TestId", "TestId", testQuestions.TestId);
            return(View(testQuestions));
        }
        public async Task <IActionResult> Create([Bind("TestId,Subject,CourseId")] Test test)
        {
            if (ModelState.IsValid)
            {
                _context.Add(test);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseId"] = new SelectList(_context.Course, "CourseId", "CourseId", test.CourseId);
            return(View(test));
        }
        public async Task <IActionResult> Create([Bind("InstructorId,Fname,Lname,CourseId")] Instructor instructor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(instructor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseId"] = new SelectList(_context.Course, "CourseId", "CourseId", instructor.CourseId);
            return(View(instructor));
        }
        public async Task <IActionResult> Create([Bind("TestResId,TestId,Score,Answers,StudentId")] TestResults testResults)
        {
            if (ModelState.IsValid)
            {
                _context.Add(testResults);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StudentId"] = new SelectList(_context.Student, "StudId", "StudId", testResults.StudentId);
            return(View(testResults));
        }
        public async Task <IActionResult> Create([Bind("CourseId,StudId")] Roster roster)
        {
            if (ModelState.IsValid)
            {
                _context.Add(roster);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseId"] = new SelectList(_context.Course, "CourseId", "CourseId", roster.CourseId);
            ViewData["StudId"]   = new SelectList(_context.Student, "StudId", "StudId", roster.StudId);
            return(View(roster));
        }