Ejemplo n.º 1
0
        public FileResult GetResultContents(Guid jobId)
        {
            if (jobId.Equals(Guid.Empty))
            {
                return(null);
            }

            using (var context = new RoboBrailleDataContext())
            {
                var job = context.Jobs.FirstOrDefault(e => jobId.Equals(e.Id));
                if (job == null || job.ResultContent == null)
                {
                    return(null);
                }
                RoboBrailleProcessor.UpdateDownloadCounterInDb(job.Id, _context);
                FileResult result = null;
                try
                {
                    result = new FileResult(job.ResultContent, job.ResultMimeType, job.FileName + job.ResultFileExtension);
                }
                catch (Exception)
                {
                    // ignored
                }
                return(result);
            }
        }
Ejemplo n.º 2
0
        public FileResult GetResultContents(Guid jobId)
        {
            if (jobId.Equals(Guid.Empty))
            {
                return(null);
            }

            var job = (GenericJob)_context.Jobs.FirstOrDefault(e => jobId.Equals(e.Id));

            if (job == null || job.ResultContent == null)
            {
                return(null);
            }

            FileResult result = null;

            try
            {
                result = new FileResult(job.ResultContent, "text/plain", "SampleResponse.txt");
                RoboBrailleProcessor.UpdateDownloadCounterInDb(job.Id, _context);
            } catch
            {
                //ignored
            }
            return(result);
        }