Exemplo n.º 1
0
        public async Task <IActionResult> Create(RegistrationFirstStepViewModel model)
        {
            if (ModelState.IsValid)
            {
                AppUser user = new AppUser
                {
                    UserName = model.Email,
                    Email    = model.Email
                };

                IdentityResult result = await _userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    foreach (IdentityError error in result.Errors)
                    {
                        ModelState.AddModelError("", error.Description);
                    }
                }
            }
            return(View(model));
        }
Exemplo n.º 2
0
 public IActionResult RegistrationFirstStep(RegistrationFirstStepViewModel model)
 {
     if (ModelState.IsValid)
     {
         if (model.IsCompanyChecked)
         {
             model.Role = RoleEnum.HiringManager;
             return(View("RegistrationSecondStepCompany", new RegistrationSecondStepCompanyViewModel()
             {
                 FirstStepModel = model
             }));
         }
         else
         {
             model.Role = RoleEnum.User;
             return(StatusCode(404));
         }
     }
     return(View(model));
 }