public async Task <(Result Result, AppUserDTO AppUserDTO)> FindAppUserByIdAsync(string appUserId)
        {
            var user = await _userManager.FindByIdAsync(appUserId);

            return(user != null
               ? (Result.Success(), _mapper.Map <AppUserDTO>(user))
               : (IdentityResultExtensions.AppUserNotFound(), new AppUserDTO()));
        }
        public async Task <Result> SignInAsync(string appUserId, bool isPasrsistent)
        {
            var user = await _userManager.FindByIdAsync(appUserId);

            if (user != null)
            {
                await SignInManager.SignInAsync(user, isPasrsistent);
            }

            return(IdentityResultExtensions.AppUserNotFound());
        }
        public async Task <Result> RemoveAppUserAsync(string appUserId)
        {
            AppUser appUser = await _userManager.FindByIdAsync(appUserId);

            if (appUser != null)
            {
                var result = await _userManager.DeleteAsync(appUser);

                return(result.Succeeded ? Result.Success() : result.ToApplicationResult());
            }

            return(IdentityResultExtensions.AppUserNotFound());
        }
        public async Task <Result> PasswordSignInAsync(string email, string password, bool isParsistent)
        {
            var user = await _userManager.FindByEmailAsync(email);

            if (user != null)
            {
                var result = await SignInManager.PasswordSignInAsync(user, password, isParsistent, false);

                return(result.Succeeded ? Result.Success() : IdentityResultExtensions.IncorrectlyEnteredEmailOrPassword());
            }

            return(IdentityResultExtensions.AppUserNotFound());
        }