示例#1
0
        public ActionResult Export(int?TypeFilter, Guid?CowId)
        {
            var          fileDownloadName = "Događaji-" + DateTime.Now.ToShortDateString() + ".xlsx";
            const string contentType      = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";

            var reportUtils = new ReportUtils();

            var fileStream = reportUtils.GenerateReport(TypeFilter, CowId);

            if (fileStream != null)
            {
                var fsr = new FileStreamResult(fileStream, contentType)
                {
                    FileDownloadName = fileDownloadName
                };
                return(fsr);
            }
            else
            {
                return(RedirectToAction("Index", "Events", new { errors = true }));
            }
        }