Example #1
0
        public async Task <IActionResult> Download(string log)
        {
            // setup
            var logName     = $"RhinoApi-{log}";
            var fullLogName = logName + ".log";

            // get report
            var(statusCode, stream) = repository.GetAsMemoryStream(logPath, log);

            // exit conditions
            if (statusCode == HttpStatusCode.NotFound)
            {
                return(await this
                       .ErrorResultAsync($"Log [{fullLogName}] under configuration [{logPath}] was not found.", HttpStatusCode.NotFound)
                       .ConfigureAwait(false));
            }

            // response
            var zipContent = stream.Zip(logName);

            return(File(zipContent, MediaTypeNames.Application.Zip, logName + ".zip"));
        }
Example #2
0
        public IActionResult Download(string log)
        {
            // setup
            var logName     = $"RhinoApi-{log}";
            var fullLogName = logName + ".log";

            // get report
            var(statusCode, stream) = repository.GetAsMemoryStream(logPath, log);

            // exit conditions
            if (statusCode == HttpStatusCode.NotFound)
            {
                return(NotFound(new
                {
                    Message = $"Log [{fullLogName}] under configuration [{logPath}] was not found."
                }));
            }

            // response
            var zipContent = stream.Zip(logName);

            return(File(zipContent, MediaTypeNames.Application.Zip, logName + ".zip"));
        }