public async Task <IActionResult> Create([Bind("CourseId,Name,DelieveryMode,Coordinator,Fees")] Courses courses)
        {
            if (ModelState.IsValid)
            {
                _context.Add(courses);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(courses));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("StudentId,Name,Address,Nationality,CourseId")] Students students)
        {
            if (ModelState.IsValid)
            {
                _context.Add(students);
                await _context.SaveChangesAsync();

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