public ActionResult ExportTo(string OutputFormat, string currentView) { GridViewSettings exportSettings = ExportUtils.CreateExportGridViewSettings(currentView); if (currentView.Equals("NcrGridView")) { var filteredAllItemRecords = from record in db.NcrRecords where NavigationFilter.FilteredNcrRecordIds.Contains(record.HseqRecordID) select record; var model = filteredAllItemRecords.ToList(); return(ExportToType(OutputFormat, exportSettings, model)); } else if (currentView.Equals("CarGridView")) { var filteredAllItemRecords = from record in db.CarRecords where NavigationFilter.FilteredCarRecordIds.Contains(record.HseqRecordID) select record; var model = filteredAllItemRecords.ToList(); return(ExportToType(OutputFormat, exportSettings, model)); } else if (currentView.Equals("ParGridView")) { var filteredAllItemRecords = from record in db.ParRecords where NavigationFilter.FilteredParRecordIds.Contains(record.HseqRecordID) select record; var model = filteredAllItemRecords.ToList(); return(ExportToType(OutputFormat, exportSettings, model)); } else if (currentView.Equals("FisGridView")) { var filteredAllItemRecords = from record in db.FisRecords where NavigationFilter.FilteredFisRecordIds.Contains(record.HseqRecordID) select record; var model = filteredAllItemRecords.ToList(); return(ExportToType(OutputFormat, exportSettings, model)); } else if (currentView.Equals("AllItemsGridView")) { } return(RedirectToAction("Index")); }