Ejemplo n.º 1
0
        public async Task <IActionResult> Account(DoctorViewModel vm)
        {
            try
            {
                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));
            }
            catch (Exception ex)
            {
                return(Error(ex));
            }
        }