//GET: Assign Trainee Course
        public ActionResult Create()
        {
            var trainee     = (from te in _context.Roles where te.Name.Contains("Trainee") select te).FirstOrDefault();
            var traineeUser = _context.Users.Where(u => u.Roles.Select(us => us.RoleId).Contains(trainee.Id)).ToList();

            var course          = _context.Courses.ToList();
            var traineecourseVM = new AssignTraineetoCourseViewModels()
            {
                Courses  = course,
                Trainees = traineeUser,
                AssignTraineetoCourses = new AssignTraineetoCourse()
            };

            return(View(traineecourseVM));
        }
        public ActionResult Create(AssignTraineetoCourseViewModels assign)
        {
            var trainee     = (from te in _context.Roles where te.Name.Contains("Trainee") select te).FirstOrDefault();
            var traineeUser = _context.Users.Where(u => u.Roles.Select(us => us.RoleId).Contains(trainee.Id)).ToList();

            var course = _context.Courses.ToList();

            if (ModelState.IsValid)
            {
                _context.AssignTraineetoCourses.Add(assign.AssignTraineetoCourses);
                _context.SaveChanges();
                return(RedirectToAction("Index"));
            }

            var traineecourseVM = new AssignTraineetoCourseViewModels()
            {
                Courses  = course,
                Trainees = traineeUser,
                AssignTraineetoCourses = new AssignTraineetoCourse()
            };

            return(View(traineecourseVM));
        }