Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("StudentId,FirstName,LastName")] Students students)
        {
            if (ModelState.IsValid)
            {
                _context.Add(students);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(students));
        }
        public async Task <IActionResult> Create([Bind("CourseNoteId,ExamName,StudentCourseId")] CoursesNotes coursesNotes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(coursesNotes);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StudentCourseId"] = new SelectList(_context.StudentCourses, "StudentCourseId", "StudentCourseId", coursesNotes.StudentCourseId);
            return(View(coursesNotes));
        }