public IEnumerable <Advertisement> GetAdvertisements( Brand brand = null, Region region = null, VehiclType vehiclType = null, TransmissionType transmission = null, List <Fuel> fuels = null, Engine from = null, Engine to = null) { using (var context = CreateContext()) { var query = _queryBuilder .For(context.ADVERTISEMENTs.AsQueryable()) .By(brand) .By(region) .By(vehiclType) .By(transmission) .By(fuels) .By(from, to) .CreateQuery(); return(query .AsEnumerable() .Select(x => new Advertisement(x)) .ToList()); } }
public IAdvertisementSearchQueryBuilder By(VehiclType vehiclType) { if (vehiclType != null) { Query = Query.Where(BuildPredicate(typeof(ADVERTISEMENT), "VEHICL.VEHICL_TYPE_ID", Expression.Equal, vehiclType.Id)); } return(this); }
public IAdvertisementSearchQueryBuilder By(VehiclType vehiclType) { Query = vehiclType != null?Query.Where(x => x.VEHICL.VEHICL_TYPE_ID == vehiclType.Id) : Query; return(this); }