public ActionResult CreateStudent([Bind(Include = "Id,FirstName,LastName,Email,Password,CourseModel_Id")] CreateSudentViewModel createSudentViewModel)
        {
            var course = context.Courses.FirstOrDefault(d => d.Id == createSudentViewModel.CourseModel_Id);

            if (ModelState.IsValid)
            {
                UserStore <Models.Identity.ApplicationUser>   userStore   = new UserStore <Models.Identity.ApplicationUser>(context);
                UserManager <Models.Identity.ApplicationUser> userManager = new UserManager <Models.Identity.ApplicationUser>(userStore);

                Models.Identity.ApplicationUser user = new Models.Identity.ApplicationUser {
                    UserName = createSudentViewModel.Email, Email = createSudentViewModel.Email, FirstName = createSudentViewModel.FirstName, LastName = createSudentViewModel.LastName
                };
                var result = userManager.Create(user, createSudentViewModel.Password);
                if (!result.Succeeded)
                {
                    throw new Exception(string.Join("\n", result.Errors));
                }
                userManager.AddToRole(user.Id, "Student");
                course.Students.Add(user);
                TempData["Message"] = "Succsessfully added a student";
                context.SaveChanges();
            }

            return(RedirectToAction("_StudentListPartial", new { id = course.Id }));
        }
        //this action result returns the partial containing the modal
        public ActionResult CreateStudent(int id)
        {
            CreateSudentViewModel csvm = new CreateSudentViewModel
            {
                CourseModel_Id = id
            };

            return(PartialView("CreateStudent", csvm));
        }