Example #1
0
        public IActionResult ExportExcel(ReportListVM vm)
        {
            vm.SearcherMode = vm.Ids != null && vm.Ids.Count > 0 ? ListVMSearchModeEnum.CheckExport : ListVMSearchModeEnum.Export;
            var data = vm.GenerateExcel();

            return(File(data, "application/vnd.ms-excel", $"Export_Report_{DateTime.Now.ToString("yyyy-MM-dd")}.xls"));
        }
Example #2
0
 public string Search(ReportListVM vm)
 {
     if (ModelState.IsValid)
     {
         return(vm.GetJson(false));
     }
     else
     {
         return(vm.GetError());
     }
 }
        public IActionResult DeleteReport()
        {
            IEnumerable <Report> allReport = _repo.GetAll();

            var vm = new ReportListVM
            {
                AllReports = _repo.GetAll().Select(x => new SelectListItem
                {
                    Text  = x.Title,
                    Value = x.Id.ToString()
                })
            };

            return(View(vm));
        }
Example #4
0
        public async Task <IActionResult> Reports(int productPage = 1, string searchByProduct = null, string searchByCategory = null)
        {
            var(reports, reportsCount) = await _reportService.GetFiltered(searchByProduct, searchByCategory, PageSize, productPage);

            var reportListVM = new ReportListVM()
            {
                Reports = reports
            };

            const string Url = "/User/Home/Reports?productPage=:";

            reportListVM.PagingInfo = new PagingInfo
            {
                CurrentPage  = productPage,
                ItemsPerPage = PageSize,
                TotalItem    = reportsCount,
                UrlParam     = Url
            };

            return(View(reportListVM));
        }
Example #5
0
 public string Search(ReportListVM vm)
 {
     return(vm.GetJson(false));
 }
Example #6
0
 public IActionResult ExportExcel(ReportListVM vm)
 {
     return(vm.GetExportData());
 }