Esempio n. 1
0
        public async Task <AUser> Login(string email, string password)
        {
            AUser user = await
                         ModelDbSets.AsNoTracking()
                         .SingleOrDefaultAsync
                         (
                e => e.Email.ToLower().Equals(email.ToLower())
                         );

            if (user == null)
            {
                return(null);
            }
            else
            {
                //If user exists check password
                // TODO : Send this to a service
                if (user.Password == password)
                {
                    return(user);
                }
                else
                {
                    return(null);
                };
            }
        }
Esempio n. 2
0
        public Customer GetCustomerByEmail(string email)
        {
            var customerDetail = ModelDbSets.AsNoTracking().Where(e => e.Email.Equals(email)).FirstOrDefault();

            if (customerDetail != null)
            {
                return(customerDetail);
            }

            throw new NotFoundException($"Customer with email {email} was not found");
        }
Esempio n. 3
0
 public async Task <bool> EmailExistAsync(string email)
 {
     return(await ModelDbSets.AsNoTracking().AnyAsync(e => e.Email.Equals(email, StringComparison.CurrentCultureIgnoreCase)));
 }
Esempio n. 4
0
 public async Task <bool> UserIdExistAsync(string userId)
 {
     return(await ModelDbSets.AsNoTracking().AnyAsync(e => e.UserId.Equals(userId)));
 }
Esempio n. 5
0
 public async Task <bool> EmailExistAsync(string email)
 {
     return(await ModelDbSets.AsNoTracking().AnyAsync(e => e.Email.Equals(email)));
 }
Esempio n. 6
0
 public async Task <IEnumerable <ARole> > GetRolesFromUser(int userId)
 {
     return(await ModelDbSets.AsNoTracking().ToListAsync());
 }