private List<TourList> loadTourList() { List<TourList> TourList = new List<TourList>(); List<TourList> sTourList = new List<TourList>(); dm = new SeyahatIstanbulEntities(); var v_TourList = (from t in dm.Tour where t.blStatus == true select new { TourId = t.sqTourId, fulName = t.chImageName, Place =t.chPlaces, Startplace =t.chStartPlace, EndPlace=t.chEndPlace, PeopleCount=t.chPersonCount, Desc =t.chDesc, ImageRoute = t.chImageName, blSlider = t.blDisplaySlider, property = t.chProperties }).Distinct().ToList(); foreach (var item in v_TourList) { List<Price> pList = (from p in dm.Price where p.rfCategoryId == 3 && p.rfProductId == item.TourId && p.blStatus == true select p).OrderBy(d => d.dgDay).ToList(); TourList Tours = new TourList(); Tours.dgTourId = item.TourId; Tours.chFulName = item.fulName; Tours.chPlaces = item.Place; Tours.chStartPlace = item.Startplace; Tours.chEndPlace = item.EndPlace; Tours.dgPeopleCount = Convert.ToInt32(item.PeopleCount); Tours.chDesc = item.Desc; Tours.chImageRoute_1 = item.ImageRoute + "_1.jpg"; Tours.chImageRoute_2 = item.ImageRoute + "_2.jpg"; Tours.chImageRoute_3 = item.ImageRoute + "_3.jpg"; Tours.chPrice_1_7 = pList[0].dgValue.ToString(); Tours.chPrice_8_15 = pList[1].dgValue.ToString() + " TL"; Tours.chPrice_16_24 = pList[2].dgValue.ToString() + " TL"; Tours.chPrice_25 = pList[3].dgValue.ToString() + " TL"; TourList.Add(Tours); } ViewBag.TourList = TourList; return TourList; }
public List<TourList> loadTourList(int sqTourId) { List<TourList> tourList = new List<TourList>(); dm = new SeyahatIstanbulEntities(); var TourList_ = (from t in dm.Tour where t.blStatus == true && t.sqTourId == sqTourId select new { dgTourId = t.sqTourId, chFulName = t.chDesc, chPlaces = t.chPlaces, dgPeopleCount = t.chPersonCount, chStartPlace = t.chStartPlace, chEndPlace = t.chEndPlace, chDesc = t.chDesc, chImageRoute = t.chImageName }).Distinct().ToList(); foreach (var item in TourList_) { List<Price> pList = (from p in dm.Price where p.rfCategoryId == 1 && p.rfProductId == item.dgTourId && p.blStatus == true select p).OrderBy(d => d.dgDay).ToList(); TourList tour = new TourList(); tour.dgTourId = item.dgTourId; tour.chPlaces = item.chPlaces; tour.dgPeopleCount = Convert.ToInt32(item.dgPeopleCount); tour.chStartPlace = item.chStartPlace; tour.chEndPlace = item.chEndPlace; tour.chDesc = item.chDesc; tour.chImageRoute_1 = item.chImageRoute + "_1.jpg"; tour.chImageRoute_2 = item.chImageRoute + "_2.jpg"; tour.chImageRoute_3 = item.chImageRoute + "_3.jpg"; tour.chPrice_1_7 = pList[0].dgValue.ToString(); tour.chPrice_8_15 = pList[1].dgValue.ToString() + " TL"; tour.chPrice_16_24 = pList[2].dgValue.ToString() + " TL"; tour.chPrice_25 = pList[3].dgValue.ToString() + " TL"; tour.imageList = (from img in dm.Images where img.rfCategory == 2 // apart && img.rfDestination == item.dgTourId select img).Distinct().ToList(); tourList.Add(tour); } return tourList; }