public virtual ActionResult GetAll([DataSourceRequest] DataSourceRequest request, string orderNumber, DateTime?dateFrom, DateTime?dateTo, int?status) { LogI("GetAll, orderNumber=" + orderNumber + ", status=" + status + ", dateFrom=" + dateFrom + ", dateTo=" + dateTo); var searchFilter = new DhlInvoiceFilterViewModel() { OrderNumber = orderNumber, DateFrom = dateFrom, DateTo = dateTo, Status = status, }; var items = DhlInvoiceViewModel.GetAll(Db, Time, searchFilter); var dataSource = items.ToDataSourceResult(request); return(Json(dataSource, JsonRequestBehavior.AllowGet)); }
public virtual ActionResult ExportToExcel(string orderNumber, DateTime?dateFrom, DateTime?dateTo, int?status) { LogI("ExportToExcel, orderNumber=" + orderNumber + ", status=" + status + ", dateFrom=" + dateFrom + ", dateTo=" + dateTo); var searchFilter = new DhlInvoiceFilterViewModel() { OrderNumber = orderNumber, DateFrom = dateFrom, DateTo = dateTo, Status = status, }; var invoices = DhlInvoiceViewModel.GetAll(Db, Time, searchFilter).ToList(); return(File(DhlInvoiceViewModel.BuildReport(invoices).ToArray(), //The binary data of the XLS file "application/vnd.ms-excel", //MIME type of Excel files "DhlInvoiceReport.xls")); //Suggested file name in the "Save as" dialog which will be displayed to the end user }