Example #1
0
        public async Task <User> Authenticate(string email, string password)
        {
            password = Helper_MD5.GenerateMD5Hash(password);
            var customer = (await user_Repository.GetAllAsync())
                           .SingleOrDefault(usr => usr.Email == email && usr.Password == password);

            if (customer == null)
            {
                return(null);
            }

            customer.GenerateToken(appSettings.Secret, appSettings.ExpiresMinutes);

            return(customer);
        }
Example #2
0
 public async Task <IEnumerable <User> > GetAllAsync()
 {
     return(await user_Repository.GetAllAsync());
 }