public async Task <IActionResult> Login(ForDHLoginViewModel loginView)
        {
            var user = citizenRepository.GetUserByNameAndPassword(loginView.Login, loginView.Password);

            if (user == null)
            {
                return(View(loginView));
            }

            //var recordId = new Claim("Id", user.Id.ToString());
            //var recordName = new Claim(ClaimTypes.Name, user.Login);
            //var recordAuthMetod = new Claim(ClaimTypes.AuthenticationMethod, Startup.MedicineAuth);

            //var page = new List<Claim>() { recordId, recordName, recordAuthMetod };

            //var claimsIdentity = new ClaimsIdentity(page, Startup.MedicineAuth);

            //var claimsPrincipal = new ClaimsPrincipal(claimsIdentity);

            //await HttpContext.SignInAsync(claimsPrincipal);

            await userService.SignInAsync(loginView.Login, loginView.Password, isPersistent : false);

            if (string.IsNullOrEmpty(loginView.ReturnUrl))
            {
                return(RedirectToAction("HealthDepartment", "HealthDepartment"));
            }
            else
            {
                return(Redirect(loginView.ReturnUrl));
            }
        }
        public IActionResult Login()
        {
            var viewvModel = new ForDHLoginViewModel();

            viewvModel.ReturnUrl = Request.Query["ReturnUrl"];

            return(View(viewvModel));
        }
        public IActionResult Registration(ForDHLoginViewModel loginView)
        {
            if (!ModelState.IsValid)
            {
                return(View(loginView));
            }

            return(RedirectToAction("HealthDepartment"));
        }
        public IActionResult MyCitizenTest(ForDHLoginViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            var user = mapper.Map <CitizenUser>(viewModel);

            citizenRepository.Save(user);
            return(View());
        }
        public IActionResult MyCitizenTest()
        {
            var viewModel = new ForDHLoginViewModel()
            {
                FirstName   = "Ivan",
                LastName    = "Ivanov",
                Gender      = Gender.Male,
                Email       = "*****@*****.**",
                PhoneNumber = "87778888888",
                IsDead      = false,
                IsMarried   = true,
                HasChildren = true,
                Balance     = 1000000000,
                BirthDate   = DateTime.Now,
                Login       = "******",
                Password    = "******"
            };

            return(View(viewModel));
        }
        public async Task <IActionResult> Login(ForDHLoginViewModel loginView)
        {
            var user = citizenRepository.GetUserByNameAndPassword(loginView.Login, loginView.Password);

            if (user == null)
            {
                return(View(loginView));
            }


            await userService.SignInAsync(loginView.Login, loginView.Password, isPersistent : false);

            if (string.IsNullOrEmpty(loginView.ReturnUrl))
            {
                return(RedirectToAction("HealthDepartment", "HealthDepartment"));
            }
            else
            {
                return(Redirect(loginView.ReturnUrl));
            }
        }