Exemplo n.º 1
0
        public async Task <IActionResult> Register(RegisterVM model)
        {
            if (ModelState.IsValid)
            {
                var user = new User()
                {
                    Email = model.Email
                };
                try
                {
                    var newUser = await _userDataService.Create(user, model.Password);

                    if (newUser != null)
                    {
                        await LogUserIn(newUser, false);

                        Microsoft.Extensions.Primitives.StringValues returnUrl = "";
                        if (Request.Query.TryGetValue("returnUrl", out returnUrl))
                        {
                            return(Redirect(Request.Query["returnUrl"]));
                        }

                        return(RedirectToAction("MyProfile", "Account"));
                    }
                }
                catch (Exception ex)
                {
                    // add errors...
                    return(View(model));
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Exemplo n.º 2
0
 public ActionResult <UserModel> Post(UserModel userModel)
 {
     return(_userDataService.Create(userModel));
 }
Exemplo n.º 3
0
 public User CreateUser(UserPublicInfo userPublicInfo)
 {
     return(_userDataService.Create(userPublicInfo));
 }