Ejemplo n.º 1
0
        //TODO dla clienta wszystko gra a dla wielu dodaje poza tym o co pytam to reszte w zbiorze tzn wszystkie PL i GB , mozna by jeszcze to jakos rozdzelic ale jak dla mnie jest w pyte
        //TODO w klasie client sa chwilowe dane, trzeba dorobic mongo i w tym miejscu powinien pobierac dane
        //TODO osobne pliki
        public async Task <Book> Get(string language)
        {
            var userLang = new UserLanguageHandler();
            var pol      = new PolishHandler();
            var eng      = new EnglishHandler();

            userLang.SetNext(eng).SetNext(pol);

            var client = Client.ClientCode(userLang, language);

            return(client);
        }
Ejemplo n.º 2
0
        public async Task <IEnumerable <Book> > GetAll(string language)
        {
            _ = populateDB();

            var userLang = new UserLanguageHandler();
            var pol      = new PolishHandler();
            var eng      = new EnglishHandler();

            userLang.SetNext(eng).SetNext(pol);

            var temp = Client.ClientCodeAll(userLang, language);


            return(temp);
        }
        public IActionResult Polish(Guid guid, [FromBody] Saxon useSaxon)
        {
            if (guid == Guid.Empty)
            {
                return(Problem("Empty GUID is invalid."));
            }

            _logger.LogInformation("Enter Polish.");

            //database process id
            Guid processId = Guid.NewGuid();

            try
            {
                Task.Run(() =>
                {
                    using (PolishHandler handler = new PolishHandler(_settings, _eventHub, _preingestCollection))
                    {
                        handler.Logger = _logger;
                        handler.SetSessionGuid(guid);
                        handler.TransformationSetting = useSaxon;
                        processId = handler.AddProcessAction(processId, typeof(PolishHandler).Name, String.Format("Polish Opex with collection ID: {0}", guid), String.Concat(typeof(PolishHandler).Name, ".json"));
                        _logger.LogInformation("Execute handler ({0}) with GUID {1}.", typeof(PolishHandler).Name, guid.ToString());
                        handler.Execute();
                    }
                });
            }
            catch (Exception e)
            {
                _logger.LogError(e, "An exception was thrown in {0}: '{1}'.", typeof(FilesChecksumHandler).Name, e.Message);
                return(ValidationProblem(e.Message, typeof(FilesChecksumHandler).Name));
            }
            _logger.LogInformation("Exit Polish.");

            return(new JsonResult(new { Message = String.Format("Polish run started."), SessionId = guid, ActionId = processId }));
        }