public ActionResult GetParkList(string searchParam) { var result = _masterServiceFacade.GetParks(searchParam).Select(x => new { id = x.Id, text = x.ParkName }); return(Json(result, JsonRequestBehavior.AllowGet)); }
//public ActionResult LoadingPark(JQueryDataTablesModel jQueryDataTablesModel) //{ // int totalRecordCount = 0; // int searchRecordCount = 0; // var parkDtos = GenericFilterHelper<ParkDto>.GetFilteredRecords( // runTimeMethod: GetParkDtos, // startIndex: jQueryDataTablesModel.iDisplayStart, // pageSize: jQueryDataTablesModel.iDisplayLength, // sortedColumns: jQueryDataTablesModel.GetSortedColumns("desc"), // totalRecordCount: out totalRecordCount, // searchRecordCount: out searchRecordCount, // searchString: jQueryDataTablesModel.sSearch, // searchColumnValues: jQueryDataTablesModel.sSearch_, // properties: new List<string> { "Id", "ParkName", "PhysicalAddress", "PhysicalZip", "PhysicalCity", "State", "TotalOwnRentals" }); // return Json(new JQueryDataTablesResponse<ParkDto>( // items: parkDtos, // totalRecords: totalRecordCount, // totalDisplayRecords: searchRecordCount, // sEcho: jQueryDataTablesModel.sEcho)); //} private List <ParkDto> GetParkDtos() { return(_masterServiceFacade.GetParks().Select(p => new ParkDto { Id = p.Id, ParkName = p.ParkName, PhysicalAddress = p.PhysicalAddress, PhysicalZip = p.PhysicalZip, PhysicalCity = p.PhysicalCity, State = p.PhysicalState.Name, TotalOwnRentals = p.Customers.Where(c => c.ParkId == p.Id).Count() }).ToList()); }