Exemplo n.º 1
0
        public async Task <IActionResult> SignUp(SignUpModel model)
        {
            if (model.IsNotValid())
            {
                model.SetInputModelValues();
                return(View(model));
            }

            var clientLog = GetClientInfoLog();
            var request   = new SignUpRequest(model.OrganizationName, model.FirstName, model.LastName,
                                              model.Email, model.Password, clientLog);
            var response = await OrganizationService.CreateOrganizationWithAdmin(request);

            if (response.Status.IsNotSuccess)
            {
                model.MapMessages(response);
                model.SetInputModelValues();
                return(View(model));
            }

            await HttpContext.SignInWithClaims(model.FirstName + " " + model.LastName, model.Email);

            return(RedirectToHome());
        }