Exemplo n.º 1
0
        public async Task <FileResult> DownLoadLogs(long userId, DateTime?startPeriod, DateTime?finishPeriod)
        {
            string path   = _userLogService.DownloadHisory(userId, startPeriod, finishPeriod);
            var    memory = new MemoryStream();

            using (var stream = new FileStream(path, FileMode.Open))
            {
                await stream.CopyToAsync(memory);
            }
            memory.Position = 0;

            return(File(memory, "text/plain", "logs.txt"));
        }