Ejemplo n.º 1
0
        public async Task <string> LoginAsync(AccountEntity parameters)
        {
            var account = await _dkmsRepository.FirstAsync <AccountEntity>(s => s.Phone == parameters.Phone);

            if (account == null)
            {
                throw new DkmsException("用户名或密码错误");
            }
            if (!_passwordFactory.VerifyPassword(account, parameters.Password))
            {
                throw new DkmsException("用户名或密码错误");
            }
            var tokenString = _tokenBuilder.Build();
            var token       = new TokenEntity
            {
                Token  = tokenString,
                UserId = account.Id
            };
            await _dkmsRepository.AddAsync(token);

            return(tokenString);
        }
Ejemplo n.º 2
0
 public async Task <Guid> AddAsync(Guid userId, GoodsStockHistoryEntity history)
 {
     history.UserId = userId;
     return(await _dkmsRepository.AddAsync(history));
 }
Ejemplo n.º 3
0
 public async Task <Guid> AddAsync <TProperty>(Guid userId, TProperty property) where TProperty : DkmsPropertyEntity
 {
     property.UserId = userId;
     return(await _dkmsRepository.AddAsync(property));
 }
Ejemplo n.º 4
0
 public async Task <Guid> AddAsync(Guid userId, GoodsEntity goods)
 {
     goods.UserId = userId;
     return(await _dkmsRepository.AddAsync(goods));
 }
Ejemplo n.º 5
0
 public async Task <Guid> AddAsync(Guid userId, GoodsStockEntity entity)
 {
     entity.UserId = userId;
     return(await _dkmsRepository.AddAsync(entity));
 }
Ejemplo n.º 6
0
 public virtual async Task <Guid> AddAsync <TPropertyValueEntity>(TPropertyValueEntity entity) where TPropertyValueEntity : DkmsPropertyValueEntity
 {
     return(await _dkmsRepository.AddAsync(entity));
 }