| | | 1 | | using OzonDomains.Models; |
| | | 2 | | using OzonRepositories.Data; |
| | | 3 | | |
| | | 4 | | namespace Services.DataServices |
| | | 5 | | { |
| | | 6 | | public class WarehouseDataServices : IDataServices |
| | | 7 | | { |
| | | 8 | | private readonly WarehouseRepository _repository; |
| | | 9 | | |
| | 0 | 10 | | public WarehouseDataServices(WarehouseRepository repository) |
| | | 11 | | { |
| | 0 | 12 | | _repository = repository; |
| | 0 | 13 | | } |
| | | 14 | | |
| | | 15 | | public async Task<List<Warehouse>> GetWarehouses() |
| | | 16 | | { |
| | 0 | 17 | | return await _repository.Get(); |
| | 0 | 18 | | } |
| | | 19 | | |
| | | 20 | | public async Task<Warehouse?> GetWarehouseAsync(int id) |
| | | 21 | | { |
| | 0 | 22 | | return await _repository.GetAsync(id); |
| | 0 | 23 | | } |
| | | 24 | | |
| | | 25 | | public async Task<List<object>> GetOrderStatuses() |
| | | 26 | | { |
| | 0 | 27 | | return await _repository.GetOrderStatuses(); |
| | 0 | 28 | | } |
| | | 29 | | |
| | | 30 | | public async Task<Warehouse?> GetWarehouseAsync(Warehouse value) |
| | | 31 | | { |
| | 0 | 32 | | return await _repository.GetAsync(value); |
| | 0 | 33 | | } |
| | | 34 | | |
| | | 35 | | public async Task<Warehouse> GetOrCreateAsync(Warehouse value) |
| | | 36 | | { |
| | 0 | 37 | | return await _repository.GetOrCreateAsync(value); |
| | 0 | 38 | | } |
| | | 39 | | |
| | | 40 | | public async Task AddWarehouse(Warehouse warehouse) |
| | | 41 | | { |
| | 0 | 42 | | await _repository.Add(warehouse); |
| | 0 | 43 | | } |
| | | 44 | | |
| | | 45 | | public async Task UpdateWarehouse(Warehouse warehouse) |
| | | 46 | | { |
| | 0 | 47 | | await _repository.Update(warehouse); |
| | 0 | 48 | | } |
| | | 49 | | |
| | | 50 | | public async Task DeleteWarehouse(Warehouse warehouse) |
| | | 51 | | { |
| | 0 | 52 | | await _repository.Delete(warehouse); |
| | 0 | 53 | | } |
| | | 54 | | |
| | | 55 | | public async Task<int> SaveChanges() |
| | | 56 | | { |
| | 0 | 57 | | return await _repository.SaveChanges(); |
| | 0 | 58 | | } |
| | | 59 | | } |
| | | 60 | | } |