public void Search(xDBDataContext db) { var places = db.Places.Where(x => x.Approved).AsQueryable(); if (TownID.HasValue) { places = places.Where(x => x.TownID == TownID); } if (Type.IsFilled()) { places = places.Where(x => x.Type == Type); } if (Atmos.IsFilled()) { places = places.Where(x => x.PlaceRatings.Any(z => z.Name == Atmos)); } if (MinPay.HasValue) { places = places.Where(x => x.MinPay >= MinPay); } if (MaxPay.HasValue) { places = places.Where(x => x.MaxPay <= MaxPay); } Result = places.ToList(); if (Order == 2) { Result = Result.OrderByDescending(x => x.CommonRating).ToList(); } else { Result = Result.OrderBy(x => x.Name).ToList(); } }
private static XmlNode _FindAtmosphereByReferenceId(XmlNodeList Atmospheres, string ReferenceId) { Debug.WriteLine($"Searching for {ReferenceId}"); foreach (XmlNode Atmos in Atmospheres) { if (Atmos.InnerXml.Contains("ThingReferenceId") && Atmos.SelectSingleNode("ThingReferenceId").InnerText == ReferenceId) { return(Atmos); } } return(null); }