// GET: Flight public ActionResult Index(string thisFilter, string searchString, int?page) { if (searchString != null) { page = 1; } else { searchString = thisFilter; } ViewBag.CurrentFilter = searchString; var Flights = from emp in empRepository.GetAllData() select emp; if (!String.IsNullOrEmpty(searchString)) { Flights = Flights.Where(emp => emp.FlightName.ToUpper().Contains(searchString.ToUpper())); } int pageSize = 4; int pageNumber = (page ?? 1); return(View(Flights.ToPagedList(pageNumber, pageSize))); // return View(Flights); }
public ActionResult LoadReport() { var Consumptions = from emp2 in empRepository2.GetAllData() select emp2; SummaryReport rpt = new SummaryReport(); List <SummaryRep> model = new List <SummaryRep>(); model = (List <SummaryRep>)AutoMapper.Mapper.Map(Consumptions, model, typeof(IEnumerable <Consumption>), typeof(List <SummaryRep>)); rpt.Load(); rpt.SetDataSource(model); DataSet ds = new DataSet(); Stream s = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return(File(s, "application/pdf")); }