| | | 1 | | using SVETA.Api.Data.DTO.Goods; |
| | | 2 | | using SVETA.Api.Services.Interfaces; |
| | | 3 | | using System; |
| | | 4 | | using System.Collections.Generic; |
| | | 5 | | using System.Linq; |
| | | 6 | | using System.Threading.Tasks; |
| | | 7 | | using WinSolutions.Sveta.Server.Services.Interfaces; |
| | | 8 | | |
| | | 9 | | namespace SVETA.Api.Services.Implements |
| | | 10 | | { |
| | | 11 | | public class DownloadGoodsImagesWorker : IDownloadGoodsImagesWorker |
| | | 12 | | { |
| | | 13 | | readonly IDownloadGoodsImagesTaskService _downloadGoodsImagesTaskService; |
| | | 14 | | |
| | 0 | 15 | | public DownloadGoodsImagesWorker(IDownloadGoodsImagesTaskService downloadGoodsImagesTaskService) |
| | 0 | 16 | | { |
| | 0 | 17 | | _downloadGoodsImagesTaskService = downloadGoodsImagesTaskService; |
| | 0 | 18 | | } |
| | | 19 | | |
| | | 20 | | public async Task<DownloadGoodsImagesStatusDTO> StartDownload(bool activeOnly) |
| | 0 | 21 | | { |
| | 0 | 22 | | return new DownloadGoodsImagesStatusDTO(await _downloadGoodsImagesTaskService.Create(activeOnly)); |
| | 0 | 23 | | } |
| | | 24 | | |
| | | 25 | | public async Task<DownloadGoodsImagesStatusDTO> GetDownloadStatus() |
| | 0 | 26 | | { |
| | 0 | 27 | | var task = await _downloadGoodsImagesTaskService.FindCurrent(); |
| | 0 | 28 | | return task != null ? new DownloadGoodsImagesStatusDTO(task) : new DownloadGoodsImagesStatusDTO(); |
| | 0 | 29 | | } |
| | | 30 | | } |
| | | 31 | | } |