Skip to content

Instantly share code, notes, and snippets.

@Daniel-sims
Created April 7, 2018 20:26
Show Gist options
  • Save Daniel-sims/e84fce88674c8946455efd93ac2387dc to your computer and use it in GitHub Desktop.
Save Daniel-sims/e84fce88674c8946455efd93ac2387dc to your computer and use it in GitHub Desktop.
public IEnumerable<Models.DbMatch.Match> GetMatchesForListOfTeamIds(long usersChampionId, IEnumerable<int> teamOne, IEnumerable<int> teamTwo, int matchCount)
{
Console.WriteLine(DateTime.Now + " finding metches of users request.");
return _dbContext.Matches
.Include(x => x.Teams).ThenInclude(y => y.Players).ThenInclude(x => x.Runes)
.Include(x => x.Teams).ThenInclude(y => y.Players).ThenInclude(x => x.Items)
.Include(x => x.Teams).ThenInclude(y => y.Players).ThenInclude(x => x.SummonerSpells)
.Include(x => x.Teams).ThenInclude(y => y.Players).ThenInclude(x => x.Events)
.Where(q => q.Teams
.All(t =>
teamOne.All(f => t.Players.Select(p => p.ChampionId).Contains(f)) ||
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment