| | | 1 | | using OzonDomains.Models; |
| | | 2 | | using OzonRepositories.Data; |
| | | 3 | | |
| | | 4 | | namespace Services.DataServices |
| | | 5 | | { |
| | | 6 | | public class ExcludedArticleDataServices : IDataServices |
| | | 7 | | { |
| | | 8 | | private readonly ExcludedArticleRepository _repository; |
| | | 9 | | |
| | 0 | 10 | | public ExcludedArticleDataServices(ExcludedArticleRepository repository) |
| | | 11 | | { |
| | 0 | 12 | | _repository = repository; |
| | 0 | 13 | | } |
| | | 14 | | |
| | | 15 | | public async Task<List<Order>> ExcludeOrdersAsync(List<Order> orders) |
| | | 16 | | { |
| | 0 | 17 | | return await _repository.GetFilteredOrdersAsync(orders); |
| | 0 | 18 | | } |
| | | 19 | | |
| | | 20 | | public async Task<int> AddExcludedArticle(ExcludedArticle value) |
| | | 21 | | { |
| | 0 | 22 | | return await _repository.Add(value); |
| | 0 | 23 | | } |
| | | 24 | | |
| | | 25 | | public async Task<int> DeleteExcludedArticle(ExcludedArticle value) |
| | | 26 | | { |
| | 0 | 27 | | return await _repository.Delete(value); |
| | 0 | 28 | | } |
| | | 29 | | |
| | | 30 | | public async Task<List<ExcludedArticle>> GetExcludedArticles() |
| | | 31 | | { |
| | 0 | 32 | | return await _repository.Get(); |
| | 0 | 33 | | } |
| | | 34 | | |
| | | 35 | | public async Task<(List<ExcludedArticle> Articles, int TotalCount)> GetExcludedArticlesPaged(int page = 1, int p |
| | | 36 | | { |
| | 0 | 37 | | var articles = await _repository.GetPaged(page, pageSize); |
| | 0 | 38 | | var totalCount = await _repository.GetTotalCount(); |
| | 0 | 39 | | return (articles, totalCount); |
| | 0 | 40 | | } |
| | | 41 | | |
| | | 42 | | |
| | | 43 | | public async Task<ExcludedArticle?> GetExcludedArticleAsync(int id) |
| | | 44 | | { |
| | 0 | 45 | | return await _repository.GetAsync(id); |
| | 0 | 46 | | } |
| | | 47 | | |
| | | 48 | | public async Task<ExcludedArticle?> GetExcludedArticleAsync(ExcludedArticle value) |
| | | 49 | | { |
| | 0 | 50 | | return await _repository.GetAsync(value); |
| | 0 | 51 | | } |
| | | 52 | | |
| | | 53 | | public async Task<int> UpdateExcludedArticle(ExcludedArticle value) |
| | | 54 | | { |
| | 0 | 55 | | return await _repository.Update(value); |
| | 0 | 56 | | } |
| | | 57 | | |
| | | 58 | | public Task<int> SaveChanges() |
| | | 59 | | { |
| | 0 | 60 | | return _repository.SaveChanges(); |
| | | 61 | | } |
| | | 62 | | |
| | | 63 | | |
| | | 64 | | } |
| | | 65 | | } |