예제 #1
0
        public ActionResult ActiveReport(ActiveReportVM model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var today = DateTime.Today;

            if (model.AccessList)
            {
                var bytes = SitesManager.GetAccessCustomersCsvBytes(model.sites.Where(x => x.ProcessCsv).Select(x => x.Id).ToList());
                var name  = today.ToString("yyyy-MM-dd") + "_access-format.csv";
                return(File(bytes, "text/csv", name));
            }
            else
            {
                var bytes = SitesManager.GetActiveUsersAccessListFile(model.sites.Where(x => x.ProcessCsv == true).Select(x => x.Id).ToList());
                var name  = today.ToString("yyyy-MM-dd") + "_simple-format.csv";
                return(File(bytes, "text/csv", name));
            }
        }