| | | 1 | | using OzonDomains.Models; |
| | | 2 | | |
| | | 3 | | namespace Services.DataServices; |
| | | 4 | | |
| | | 5 | | public class OrderHistoryDataService : IOrderHistoryDataService |
| | | 6 | | { |
| | | 7 | | private readonly IOrderHistoryRepository _repository; |
| | | 8 | | |
| | 0 | 9 | | public OrderHistoryDataService(IOrderHistoryRepository repository) |
| | | 10 | | { |
| | 0 | 11 | | _repository = repository; |
| | 0 | 12 | | } |
| | | 13 | | |
| | | 14 | | public async Task<int> AddOrderHistory(OrderHistory value) |
| | | 15 | | { |
| | 0 | 16 | | return await _repository.Add(value); |
| | 0 | 17 | | } |
| | | 18 | | |
| | | 19 | | public async Task<int> DeleteOrderHistory(OrderHistory value) |
| | | 20 | | { |
| | 0 | 21 | | return await _repository.Delete(value); |
| | 0 | 22 | | } |
| | | 23 | | |
| | | 24 | | public async Task<List<OrderHistory>> GetOrderHistories() |
| | | 25 | | { |
| | 0 | 26 | | return await _repository.Get(); |
| | 0 | 27 | | } |
| | | 28 | | |
| | | 29 | | public async Task<OrderHistory?> GetOrderHistoryAsync(int id) |
| | | 30 | | { |
| | 0 | 31 | | return await _repository.GetAsync(id); |
| | 0 | 32 | | } |
| | | 33 | | |
| | | 34 | | public async Task<List<OrderHistory>> GetByOrderIdAsync(int orderId) |
| | | 35 | | { |
| | 0 | 36 | | return await _repository.GetByOrderIdAsync(orderId); |
| | 0 | 37 | | } |
| | | 38 | | |
| | | 39 | | public async Task<List<OrderHistory>> GetRecentChangesAsync(int count = 50) |
| | | 40 | | { |
| | 0 | 41 | | return await _repository.GetRecentChangesAsync(count); |
| | 0 | 42 | | } |
| | | 43 | | |
| | | 44 | | public async Task<List<OrderHistory>> GetChangesAfterDateAsync(DateTime afterDate) |
| | | 45 | | { |
| | 0 | 46 | | return await _repository.GetChangesAfterDateAsync(afterDate); |
| | 0 | 47 | | } |
| | | 48 | | |
| | | 49 | | public async Task<int> UpdateOrderHistory(OrderHistory value) |
| | | 50 | | { |
| | 0 | 51 | | return await _repository.Update(value); |
| | 0 | 52 | | } |
| | | 53 | | |
| | | 54 | | public Task<int> SaveChanges() |
| | | 55 | | { |
| | 0 | 56 | | throw new NotImplementedException(); |
| | | 57 | | } |
| | | 58 | | } |