示例#1
0
        public async Task <LoginResult> LoginAsync(LoginModel loginModel)
        {
            var exists = authDataProvider.Users.FirstOrDefault(x => x.Email == loginModel.Login && x.PasswordHash == cryptService.CreateHash(loginModel.Password));

            if (exists == null)
            {
                return(null);
            }
            var res = await GenerateTokenAndResult(exists);

            await authDataProvider.SaveChangesAsync();

            return(res);
        }