Example #1
0
        public async Task <IActionResult> Account(UserViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var user = vm.ConvertToDataModel();
                await _userService.PatchUser(user);

                var principal = await _userService.Authenticate(user);

                await HttpContext
                .SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal);

                return(RedirectToAction("Index", "Home"));
            }

            return(View(vm));
        }