Example #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));
        }
 public ActionResult <UserModel> Post(UserModel userModel)
 {
     return(_userDataService.Create(userModel));
 }
Example #3
0
 public User CreateUser(UserPublicInfo userPublicInfo)
 {
     return(_userDataService.Create(userPublicInfo));
 }