Пример #1
0
        public async Task <int> DeleteUserPriceDetail(int id)
        {
            UserPriceDetail userPriceDetail = await _allInOneContext.UserPriceDetail.FirstOrDefaultAsync(s => s.Id == id);

            _allInOneContext.UserPriceDetail.Remove(userPriceDetail);
            return(await _allInOneContext.SaveChangesAsync());
        }
Пример #2
0
        public async Task <UserPriceDetailModel> GetUserPriceDetail(int id)
        {
            UserPriceDetailModel userPriceDetailModel = new UserPriceDetailModel();
            UserPriceDetail      userPriceDetail      = await _priceRepository.GetUserPriceDetail(id);

            userPriceDetailModel.CreditAmount = userPriceDetail.CreditAmount;
            userPriceDetailModel.DebitAmount  = userPriceDetail.DebitAmount;
            userPriceDetailModel.Id           = userPriceDetail.Id;
            userPriceDetailModel.UserId       = userPriceDetail.UserId;
            return(userPriceDetailModel);
        }
Пример #3
0
        public async Task <List <UserPriceDetailModel> > UpdateUserPriceDetail(UserPriceDetailModel userPriceDetailModel)
        {
            UserPriceDetail userPriceDetail = await _priceRepository.GetUserPriceDetail(userPriceDetailModel.Id);

            userPriceDetail.UserId       = userPriceDetailModel.UserId;
            userPriceDetail.CreditAmount = userPriceDetailModel.CreditAmount;
            userPriceDetail.DebitAmount  = userPriceDetailModel.DebitAmount;
            userPriceDetail.ModifiedBy   = userPriceDetailModel.UserId;
            userPriceDetail.ModifiedByTs = DateTime.Now;
            await _priceRepository.UpdateUserPriceDetail(userPriceDetail);

            return(await GetUserPriceDetailList());
        }
Пример #4
0
        public async Task <List <UserPriceDetailModel> > SaveUserPriceDetail(UserPriceDetailModel userPriceDetailModel)
        {
            UserPriceDetail userPriceDetail = new UserPriceDetail();

            userPriceDetail.UserId       = userPriceDetailModel.UserId;
            userPriceDetail.CreditAmount = userPriceDetailModel.CreditAmount;
            userPriceDetail.DebitAmount  = userPriceDetailModel.DebitAmount;
            userPriceDetail.CreatedBy    = userPriceDetailModel.UserId;
            userPriceDetail.CreatedByTs  = DateTime.Now;
            await _priceRepository.SaveUserPriceDetail(userPriceDetail);

            return(await GetUserPriceDetailList());
        }
Пример #5
0
 public async Task <int> UpdateUserPriceDetail(UserPriceDetail userPriceDetail)
 {
     _allInOneContext.UserPriceDetail.Update(userPriceDetail);
     return(await _allInOneContext.SaveChangesAsync());
 }
Пример #6
0
        public async Task <int> SaveUserPriceDetail(UserPriceDetail userPriceDetail)
        {
            await _allInOneContext.UserPriceDetail.AddAsync(userPriceDetail);

            return(await _allInOneContext.SaveChangesAsync());
        }