| | | 1 | | using OzonDomains.Models; |
| | | 2 | | using OzonRepositories.Data; |
| | | 3 | | |
| | | 4 | | namespace Services.DataServices |
| | | 5 | | { |
| | | 6 | | public class TransactionDataServices : IDataServices, ITransactionDataServices |
| | | 7 | | { |
| | | 8 | | private readonly TransactionRepository _repository; |
| | | 9 | | |
| | 91 | 10 | | public TransactionDataServices(TransactionRepository transactionRepository) |
| | | 11 | | { |
| | 91 | 12 | | _repository = transactionRepository; |
| | 91 | 13 | | } |
| | | 14 | | |
| | | 15 | | public async Task AddTransaction(Transaction value) |
| | | 16 | | { |
| | 0 | 17 | | await _repository.Add(value); |
| | 0 | 18 | | } |
| | | 19 | | |
| | | 20 | | public async Task<int> DeleteTransaction(Transaction value) |
| | | 21 | | { |
| | 0 | 22 | | return await _repository.Delete(value); |
| | 0 | 23 | | } |
| | | 24 | | |
| | | 25 | | public IQueryable<Transaction> GetTransactions() |
| | | 26 | | { |
| | 24 | 27 | | return _repository.Get(); |
| | | 28 | | } |
| | | 29 | | |
| | | 30 | | public async Task<Transaction?> GetTransaction(int id) |
| | | 31 | | { |
| | 7 | 32 | | return await _repository.GetAsync(id); |
| | 7 | 33 | | } |
| | | 34 | | |
| | | 35 | | public async Task<Transaction?> GetTransaction(Transaction value) |
| | | 36 | | { |
| | 0 | 37 | | return await _repository.GetAsync(value); |
| | 0 | 38 | | } |
| | | 39 | | |
| | | 40 | | public async Task<List<Transaction>> GetTransactionsByIdsAsync(IEnumerable<int> ids) |
| | | 41 | | { |
| | 0 | 42 | | return await _repository.GetByIdsAsync(ids); |
| | 0 | 43 | | } |
| | | 44 | | |
| | | 45 | | public IQueryable<Transaction> GetTransactions(int skip, int take) |
| | | 46 | | { |
| | 0 | 47 | | return _repository.GetTransactionsWithPagination(skip, take); |
| | | 48 | | } |
| | | 49 | | |
| | | 50 | | public async Task<int> GetTotalOrderCount() |
| | | 51 | | { |
| | 0 | 52 | | return await _repository.GetTotalTransactionCount(); |
| | 0 | 53 | | } |
| | | 54 | | |
| | | 55 | | |
| | | 56 | | public Task<int> UpdateTransaction(Transaction value) |
| | | 57 | | { |
| | 0 | 58 | | return _repository.Update(value); |
| | | 59 | | } |
| | | 60 | | |
| | | 61 | | public Task<int> UpdateTransactionComment(int transactionId, string comment) |
| | | 62 | | { |
| | 0 | 63 | | return _repository.UpdateComment(transactionId, comment); |
| | | 64 | | } |
| | | 65 | | |
| | | 66 | | public async Task<int> SaveChanges() |
| | | 67 | | { |
| | 0 | 68 | | return await _repository.SaveChanges(); |
| | 0 | 69 | | } |
| | | 70 | | |
| | | 71 | | public async Task LoadClientStatusColorsForOrders(List<Order> orders) |
| | | 72 | | { |
| | 0 | 73 | | await _repository.LoadClientStatusColorsForOrders(orders); |
| | 0 | 74 | | } |
| | | 75 | | |
| | | 76 | | } |
| | | 77 | | } |