public async Task Execute(FilmNameRequestDTO requestDTO)
        {
            if (_validator.IsValid(requestDTO, out var validationResult) == false)
            {
                throw new ArgumentException(validationResult);
            }

            var movieInfo = await _repository.QueryFindImdbByFilmName(requestDTO.FilmName);

            _presentier.Handle(movieInfo);
        }
Exemplo n.º 2
0
        public async Task Execute(SpaceObjectNameRequestDTO requestDTO)
        {
            if (_validator.IsValid(requestDTO, out var validationResult) == false)
            {
                throw new ArgumentException(validationResult);
            }

            var imageDTO = await _repository.QueryFindSpaceObjectImage(new RequestToWebRepositoryDTO { Number = "0", Variants = new List <string> {
                                                                                                           requestDTO.SpaceObjectName
                                                                                                       } });

            _presentier.Handle(imageDTO);
        }
Exemplo n.º 3
0
        public async Task Execute(XLSFileRequestDTO requestDTO)
        {
            if (_validator.IsValid(requestDTO, out var validationResult) == false)
            {
                throw new ArgumentException(validationResult);
            }


            var results     = new List <MovieDTO>();
            var tempResults = await _repository.QueryGetDataFromColumnUntilEmpty(requestDTO);

            foreach (var res in tempResults.SearchResultsList)
            {
                results.Add(new MovieDTO {
                    Name = res.ElementAtOrDefault(0), Year = res.ElementAtOrDefault(1)
                });
            }

            _presentier.Handle(new MovieInfoResponseDTO {
                SearchResultsList = results
            });
        }
Exemplo n.º 4
0
        public async Task Execute(XLSFileRequestDTO requestDTO)
        {
            string type;

            if (_validator.IsValid(requestDTO, out var validationResult) == false)
            {
                throw new ArgumentException(validationResult);
            }

            //var fileSaver = new BitmapImageHelper();
            XLSColumnsToListDTO tempResults = await _xlsRepository.QueryGetDataFromColumnUntilEmpty(requestDTO);

            foreach (var res in tempResults.SearchResultsList)
            {
                var requestWebRepository = new RequestToWebRepositoryDTO
                {
                    Number   = res.ElementAtOrDefault(0),
                    Variants = new List <string>
                    {
                        res.ElementAtOrDefault(2).ToString(),
                        $"{res.ElementAtOrDefault(2)} {GetStringTypeSpaceObject(res.ElementAtOrDefault(1))}"
                    }
                };

                SpaceObjectImageResponseDTO imageDTO = await _webRepository.QueryFindSpaceObjectImage(requestWebRepository);


                if (imageDTO.SpaceObjectImage != null)
                {
                    BitmapImageHelper.SaveImage(imageDTO.SpaceObjectImage, requestDTO.TargetFolder, res.ElementAtOrDefault(0) + "_" + res.ElementAtOrDefault(2));
                }
            }
            _presentier.Handle(new SpaceObjectImagesSaveToFilesResponseDTO {
                Result = true
            });
        }