Пример #1
0
        public async Task <IActionResult> login(AccountViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                ApplicationUsers applicationUser = AutoMapper.Mapper.Map <ApplicationUsers>(viewModel.LoginViewModel);
                (bool sucess, string[] result, ApplicationUsers _ApplicationUsers) = await accountManager.CheckPasswordSignInAsync(viewModel.LoginViewModel.Email, viewModel.LoginViewModel.Password, viewModel.LoginViewModel.RememberMe);

                if (sucess)
                {
                    await accountManager.SignInAsync(_ApplicationUsers, true);

                    return(RedirectToActionPermanent("Index", "account"));
                }

                ModelState.AddModelError(EnumAlert.Error.ToString(), string.Join(",", result));
            }

            return(View(viewModel));
        }