public static void SeedUsers
            (UserManager <PrimaImotiUser> userManager)
        {
            if (userManager.FindByNameAsync("dimitar").Result == null)
            {
                PrimaImotiUser user = new PrimaImotiUser();
                user.UserName = "******";
                var adminPassword = "******";

                IdentityResult result = userManager.CreateAsync
                                            (user, adminPassword).Result;

                if (result.Succeeded)
                {
                    userManager.AddToRoleAsync(user, "Admin").Wait();
                }
            }

            if (userManager.FindByEmailAsync("*****@*****.**").Result == null)
            {
                PrimaImotiUser user = new PrimaImotiUser();
                user.UserName = "******";

                var password = "******";

                IdentityResult result = userManager.CreateAsync
                                            (user, password).Result;

                if (result.Succeeded)
                {
                    userManager.AddToRoleAsync(user, "User").Wait();
                }
            }
        }
        public async Task <IActionResult> OnPostAsync(string returnUrl = null)
        {
            returnUrl      = returnUrl ?? Url.Content("~/");
            ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();
            if (ModelState.IsValid)
            {
                var user = new PrimaImotiUser {
                    UserName = Input.UserName
                };
                var result = await _userManager.CreateAsync(user, Input.Password);

                if (result.Succeeded)
                {
                    _userManager.AddToRoleAsync(user, "User").Wait();
                    _logger.LogInformation("User created a new account with password.");


                    await _signInManager.SignInAsync(user, isPersistent : false);

                    return(LocalRedirect(returnUrl));
                }

                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError(string.Empty, error.Description);
                }
            }

            // If we got this far, something failed, redisplay form
            return(Page());
        }