public async Task <IActionResult> Create([Bind("ID,Topic,Grade")] Course course)
        {
            if (ModelState.IsValid)
            {
                _context.Add(course);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(course));
        }
        public async Task <IActionResult> Create([Bind("ID,Name,Gender,Email,MobileNo,Birthdate,TrackId")] Trainee trainee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(trainee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TrackId"] = new SelectList(_context.Tracks, "ID", "ID", trainee.TrackId);
            return(View(trainee));
        }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("CourseId,TackId")] CourseTrack courseTrack)
        {
            if (ModelState.IsValid)
            {
                _context.Add(courseTrack);
                await _context.SaveChangesAsync();

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