Exemplo n.º 1
0
        public async Task <IActionResult> Post([FromBody] HocrLinkRequest hocrLink)
        {
            if (hocrLink?.Url == null)
            {
                return(BadRequest());
            }

            await _hocrService.AddDocument(hocrLink);

            return(Ok());
        }
Exemplo n.º 2
0
        public async Task AddDocument(HocrLinkRequest hocrLink)
        {
            if (hocrLink?.Url == null)
            {
                return;
            }

            var fileLines = await _fileLoader.GetFileLinesAsync(hocrLink.Url);

            var hocrList = await _hocrParser.ParseLinesAsync(fileLines);

            var newDocument = await _hocrMapper.MapAsync(hocrLink.Url, hocrList);

            await _repository.CreateDbIfNotExist();

            await _repository.SaveDocument(newDocument);
        }