public IActionResult Get(Guid id)
        {
            var result = _paperService.Get(id);

            if (result != null)
            {
                var paper = _mapper.Map <Paper, PaperArchiveModel>(result);
                return(Ok(paper));
            }
            else
            {
                return(StatusCode(404));
            }
        }
예제 #2
0
        public async Task <IActionResult> GetFile(Guid id)
        {
            var paper  = _paperService.Get(id);
            var result = _paperArchieveService.GetByPaperId(id);

            if (result != null)
            {
                FileInfo file = new FileInfo(result.Location);
                _paperStatisticsService.AddDownloaded(id);

                return(File(await ReadFile(result.Location), "application/pdf"));
            }
            else
            {
                return(StatusCode(404));
            }
        }