Skip to content

Instantly share code, notes, and snippets.

@moaschterle
Last active August 29, 2015 14:15
Show Gist options
  • Save moaschterle/964f2d0b76ddf523be0f to your computer and use it in GitHub Desktop.
Save moaschterle/964f2d0b76ddf523be0f to your computer and use it in GitHub Desktop.
private IEnumerable<ActivityPoiReduced> GetAllPoiReduced(string language, string activitytype, List<string> tvlist, List<string> subtypelist, List<string> arealist, List<string> mysmgtaglist, bool highlight)
{
using (var session = documentStore.OpenSession())
{
var activityquery = session.Query<PoiBaseInfos, ActivityPoiMegaFilterMM>()
.Where(x => x.Type == activitytype)
.WhereIf(tvlist.Count > 0, x => x.TourismorganizationId.In(tvlist))
.WhereIf(subtypelist.Count > 0, x => x.SubType.In(subtypelist))
.WhereIf(mysmgtaglist.Count > 0, x => x.SmgTags.In(mysmgtaglist))
.WhereIf(highlight, x => x.Highlight == true)
.AddTransformerParameter("lang", language)
.TransformWith<ActivityPoiReducedTransformer, ActivityPoiReduced>();
//IEnumerator<StreamResult<AccommodationReduced>>
IEnumerator<StreamResult<ActivityPoiReduced>> results = session.Advanced.Stream<ActivityPoiReduced>(activityquery);
while (results.MoveNext())
yield return results.Current.Document;
}
}
//Des riafi do drinn au
[HttpGet, Route("api/Poi/ReducedAsync/{language}/{activitytype}/{subtypefilter}/{locfilter}/{areafilter}/{highlightfilter}/{smgtags}")]
public async Task<IEnumerable<ActivityPoiReduced>> GetReducedAsync(string language, string activitytype, string subtypefilter, string locfilter, string areafilter, string highlightfilter, string smgtags)
{
var subtypelist = Common.ActivityPoiListCreator.CreatePoiSubTypeList(activitytype, subtypefilter);
var tvlist = await Common.LocationListCreator.CreateTourismvereinsListAsync(locfilter, RavenSession);
var arealist = await Common.LocationListCreator.CreateActivityAreaListAsync(areafilter, RavenSession);
var mysmgtaglist = Common.CommonListCreator.CreateIdList(smgtags);
//highlight
bool highlight = false;
if (highlightfilter == "true")
highlight = true;
return GetAllPoiReduced(language, activitytype, tvlist, subtypelist, arealist, mysmgtaglist, highlight);
}
//Aufruaf von der Gschicht
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment