Ejemplo n.º 1
0
 public ActionResult Register()
 {
     if (Request.IsAuthenticated)
     {
         return RedirectToRoute("Dashboard");
     }
     RegisterViewModel model = new RegisterViewModel();
     return View(model);
 }
Ejemplo n.º 2
0
 public ActionResult Register(RegisterViewModel register)
 {
     if (ModelState.IsValid)
     {
         var status = _membershipService.CreateUser(register.UserName, register.Password, register.Email);
         if (status.ToString() == "Success")
         {
             return RedirectToAction("Login", "Account");
         }
         else if (status.ToString() == "DuplicateEmail") {
             ModelState.AddModelError("", "Duplicate Email");
         }
         else if (status.ToString() == "DuplicateUserName") {
             ModelState.AddModelError("", "Duplicate UserName");
         }
     }
     return View(register);
 }