Exemplo n.º 1
0
        public async Task <PartnerCredentials> GetByClientIdAsync(string clientId)
        {
            clientId = _hashingHelper.Sha256HashEncoding1252(clientId);
            using (var context = _contextFactory.CreateDataContext())
            {
                var entity = await context.PartnerCredentials.FirstOrDefaultAsync(p => p.ClientId == clientId);

                return(_mapper.Map <PartnerCredentials>(entity));
            }
        }
Exemplo n.º 2
0
        public async Task CreateAsync(
            string customerId,
            string login,
            string password)
        {
            login = NormalizeLogin(login);
            login = _hashingHelper.Sha256HashEncoding1252(login);
            var entity = CustomerCredentialsEntity.Create(
                customerId,
                login,
                password);

            using (var context = _contextFactory.CreateDataContext())
            {
                await context.CustomerCredentials.AddAsync(entity);

                await context.SaveChangesAsync();
            }
        }
Exemplo n.º 3
0
        public async Task <AdminCredentials> GetByLoginAsync(string login)
        {
            var normalizedLogin = NormalizeLogin(login);

            login = _hashingHelper.Sha256HashEncoding1252(login);
            using (var context = _contextFactory.CreateDataContext())
            {
                var entity =
                    await context.AdminCredentials.FindAsync(login) ??
                    await context.AdminCredentials.FindAsync(_hashingHelper.Sha256HashEncoding1252(normalizedLogin));

                return(_mapper.Map <AdminCredentials>(entity));
            }
        }