public JsonParking ParkingList(int id) { List <ParkingViewModel> parkingList = new List <ParkingViewModel>(); List <AirPortDataLayer.Crud.VeiwModel.FeatureValueVeiwModel> featureValuesList = new List <AirPortDataLayer.Crud.VeiwModel.FeatureValueVeiwModel>(); JsonParking jsonParking = new JsonParking(); try { var parking = _place.AirportParkingList(Convert.ToInt32(id)); foreach (var item in parking) { ParkingViewModel parkingOBJ = new ParkingViewModel(); if (item != null && item.AirportId != null) { parkingOBJ.Cost = item.Cost.ToString(); parkingOBJ.Airport = item.Name; parkingOBJ.LocationX = _address.FindById(item.AdressId).LocationX; parkingOBJ.LocationY = _address.FindById(item.AdressId).LocationY; parkingOBJ.LocationR = _address.FindById(item.AdressId).LocationR; parkingOBJ.AddressDetail = _address.FindById(item.AdressId).Detail; parkingOBJ.CityName = _city.FindById(_address.FindById(_place.FindById(item.Id).AdressId).CityId).Name; parkingOBJ.StateName = _state.FindById(_city.FindById(_address.FindById(_place.FindById(item.Id).AdressId).CityId).CityStateId).Name; parkingOBJ.Categori = _category.FindById(item.CategoryId).CategoryName; parkingList.Add(parkingOBJ); var featurelist = _detail.FeatureValues(item.DetailId); foreach (var x in featurelist) { AirPortDataLayer.Crud.VeiwModel.FeatureValueVeiwModel featureValue = new AirPortDataLayer.Crud.VeiwModel.FeatureValueVeiwModel(); featureValue.name = x.name; featureValue.value = x.value; featureValuesList.Add(featureValue); } parkingOBJ.Detail = featureValuesList; } } jsonParking.result = parkingList; return(jsonParking); } catch (Exception ex) { string Mes = ex.Message; return(jsonParking); } }