public async Task <Hero> GetRandomHero(RandomHeroOptions options = null) { var heroes = await _heroService.GetHeroes(); if (options?.InGameCategoryIds != null && options.InGameCategoryIds.Any()) { heroes = heroes.Where(x => x.InGameCategories.Any(y => options.InGameCategoryIds.Contains(y.Id))).ToList(); } if (options?.UniverseIds != null && options.UniverseIds.Any()) { heroes = heroes.Where(x => options.UniverseIds.Contains(x.Universe.Id)).ToList(); } if (options?.HeroIds != null && options.HeroIds.Any()) { heroes = heroes.Where(x => options.HeroIds.Contains(x.Id)).ToList(); } return(GetAnyRandomHero(heroes)); }
public async Task <HeroViewModel> GetRandomHero(RandomHeroOptions options) => _mapper.Map <HeroViewModel>(await _randomiserService.GetRandomHero(options));