Ejemplo n.º 1
0
 public ActionResult TeacherSignUp(Models.User user)
 {
     if (ModelState.IsValid)
     {
         var newUser = new InterdisciplinaryDomainModel.Database.User() {FirstName = user.FirstName,
             LastName=user.LastName,
             Email = user.Email,
             Password = user.Password,
             Phone = user.Phone,
             Address = user.Address,
             Education = user.Education,
             Birthday = user.Birthday,
             Summary = user.Summary
         };
         var courses = DB.Courses.Where(c => user.CoursesId.Contains(c.ID)).ToList();
         foreach (var course in courses)
         {
             newUser.Courses.Add(course);
         }
         DB.Users.Add(newUser);
         DB.SaveChanges();
         return RedirectToAction("Index", "Category");
     }
     ViewBag.Courses = DB.Courses.ToList();
     return View(user);
 }
Ejemplo n.º 2
0
 public ActionResult TeacherSignUp(Models.User user)
 {
     if (ModelState.IsValid)
     {
         var newUser = new InterdisciplinaryDomainModel.Database.User()
         {
             FirstName = user.FirstName,
             LastName  = user.LastName,
             Email     = user.Email,
             Password  = user.Password,
             Phone     = user.Phone,
             Address   = user.Address,
             Education = user.Education,
             Birthday  = user.Birthday,
             Summary   = user.Summary
         };
         var courses = DB.Courses.Where(c => user.CoursesId.Contains(c.ID)).ToList();
         foreach (var course in courses)
         {
             newUser.Courses.Add(course);
         }
         DB.Users.Add(newUser);
         DB.SaveChanges();
         return(RedirectToAction("Index", "Category"));
     }
     ViewBag.Courses = DB.Courses.ToList();
     return(View(user));
 }
Ejemplo n.º 3
0
 public ActionResult SignUpPartial(User user)
 {
     if (ModelState.IsValid)
     {
         DB.Users.Add(user);
         DB.SaveChanges();
     }
     return RedirectToAction("Login","Login");
 }
Ejemplo n.º 4
0
 public ActionResult StudentSignUp(Models.User user)
 {
     if (ModelState.IsValid)
     {
         var newUser = new InterdisciplinaryDomainModel.Database.User()
         {
             FirstName = user.FirstName,
             LastName = user.LastName,
             Email = user.Email,
             Password = user.Password,
             Phone = user.Phone,
             Address = user.Address,
             Birthday = user.Birthday,
         };
         DB.Users.Add(newUser);
         DB.SaveChanges();
         return RedirectToAction("Index", "Category");
     }
     return View(user);
 }
Ejemplo n.º 5
0
 public ActionResult StudentSignUp(Models.User user)
 {
     if (ModelState.IsValid)
     {
         var newUser = new InterdisciplinaryDomainModel.Database.User()
         {
             FirstName = user.FirstName,
             LastName  = user.LastName,
             Email     = user.Email,
             Password  = user.Password,
             Phone     = user.Phone,
             Address   = user.Address,
             Birthday  = user.Birthday,
         };
         DB.Users.Add(newUser);
         DB.SaveChanges();
         return(RedirectToAction("Index", "Category"));
     }
     return(View(user));
 }