public IEnumerable <Matchup> GetListMatchupByRole(Player player, MatchupInfos matchupInfos) { IEnumerable <Matchup> listMatchup = Enumerable.Empty <Matchup>().AsQueryable(); switch (player.Role) { case (int)roleList.Top: listMatchup = GetEstimatedAnswersAsToplaner(player, matchupInfos); break; case (int)roleList.Mid: listMatchup = GetEstimatedAnswersAsMidlaner(player, matchupInfos); break; case (int)roleList.Adc: listMatchup = GetEstimatedAnswersAsAdc(player, matchupInfos); break; case (int)roleList.Support: listMatchup = GetEstimatedAnswersAsSupport(player, matchupInfos); break; default: break; } return(listMatchup); }
public bool isPerfectMatchupExistWithMatchupInfo(MatchupInfos matchupInfos, Guid playerId) { var listMatchup = db.Matchups.Where(x => x.PlayerId == playerId); listMatchup = listMatchup.Where(x => x.AllyTop == matchupInfos.AllyTop); listMatchup = listMatchup.Where(x => x.AllyJungle == matchupInfos.AllyJungle); listMatchup = listMatchup.Where(x => x.AllyMid == matchupInfos.AllyMid); listMatchup = listMatchup.Where(x => x.AllyAdc == matchupInfos.AllyAdc); listMatchup = listMatchup.Where(x => x.AllySupport == matchupInfos.AllySupport); listMatchup = listMatchup.Where(x => x.EnemyTop == matchupInfos.EnemyTop); listMatchup = listMatchup.Where(x => x.EnemyJungle == matchupInfos.EnemyJungle); listMatchup = listMatchup.Where(x => x.EnemyMid == matchupInfos.EnemyMid); listMatchup = listMatchup.Where(x => x.EnemyAdc == matchupInfos.EnemyAdc); listMatchup = listMatchup.Where(x => x.EnemySupport == matchupInfos.EnemySupport); if (matchupInfos.PatchVersion != null) { listMatchup = listMatchup.Where(x => x.PatchVersion == matchupInfos.PatchVersion); } if (listMatchup.Count() > 0) { return(true); } return(false); }
public JsonResult AddMatchup(MatchupInfos obj) { var dal = new DALMatchup(); int result = dal.AddMatchup(obj); return(Json("", JsonRequestBehavior.AllowGet)); }
public JsonResult CreateNewMatchup(Guid playerId, MatchupInfos obj) { var dalMatchup = new DALMatchup(); var matchupId = dalMatchup.createNewMatchup(playerId, obj); if (matchupId != Guid.Empty) { return(Json(matchupId, JsonRequestBehavior.AllowGet)); } return(Json(null, JsonRequestBehavior.AllowGet)); }
public MatchupInfos getMatchupByMatchupId(Guid matchupId) { MatchupInfos matchupInfos = new MatchupInfos(); var matchup = db.Matchups.Where(x => x.MatchupId == matchupId).FirstOrDefault(); var comments = db.MatchupComments.Where(x => x.PlayerId == matchup.PlayerId && x.MatchupId == matchupId).OrderByDescending(x => x.CreationDate).ToList(); matchupInfos = ConvertMatchupsToMatchupInfos(new List <Matchup>() { matchup }, comments).FirstOrDefault(); return(matchupInfos); }
public ActionResult UpdateSearchResults(Guid playerId, MatchupInfos matchupInfos) { var matchupDal = new DALMatchup(); Stopwatch s = new Stopwatch(); s.Start(); var listMatchupInfos = matchupDal.getAllMatchupByParams(playerId, matchupInfos); s.Stop(); ViewBag.CalculationTime = listMatchupInfos.Item2 / 1000d; ViewBag.AutomaticResults = listMatchupInfos.Item3; return(PartialView("SearchResults", listMatchupInfos.Item1)); }
public int AddMatchup(MatchupInfos matchupInfos) { int result = -1; Matchup matchup = buildMatchupEntity(matchupInfos); List <MatchupRespons> matchupResponses = buildMatchupResponsEntity(matchupInfos, matchup.MatchupResponseId); List <MatchupComment> matchupComments = buildMatchupCommentsEntity(matchupInfos, matchup); if (matchup.MatchupId != Guid.Empty) { result = saveMatchup(matchup, matchupResponses, matchupComments); } return(result); }
public Guid createNewMatchup(Guid playerId, MatchupInfos matchupInfos) { Matchup matchup = buildMatchupEntity(matchupInfos); List <MatchupRespons> matchupResponses = buildMatchupResponsEntity(matchupInfos, matchup.MatchupResponseId); matchup.PlayerId = playerId; using (TransactionScope scope = new TransactionScope()) { db.Matchups.Add(matchup); db.MatchupResponses.AddRange(matchupResponses); db.SaveChanges(); scope.Complete(); return(matchup.MatchupId); } }
public List <MatchupRespons> buildMatchupResponsEntity(MatchupInfos matchupInfos, Guid matchupResponseId) { List <MatchupRespons> matchupResponses = new List <MatchupRespons>(); if (matchupInfos.Answers?.Count > 0) { foreach (var answer in matchupInfos.Answers) { MatchupRespons matchupRespons = new MatchupRespons(); matchupRespons.ChampionId = answer.ChampionId; matchupRespons.MatchupResponseId = matchupResponseId; matchupRespons.CreationDate = DateTime.Now; matchupResponses.Add(matchupRespons); } } return(matchupResponses); }
public Matchup buildMatchupEntity(MatchupInfos matchupInfos) { Matchup matchup = new Matchup(); matchup.AllyTop = matchupInfos.AllyTop; matchup.AllyJungle = matchupInfos.AllyJungle; matchup.AllyMid = matchupInfos.AllyMid; matchup.AllyAdc = matchupInfos.AllyAdc; matchup.AllySupport = matchupInfos.AllySupport; matchup.EnemyTop = matchupInfos.EnemyTop; matchup.EnemyJungle = matchupInfos.EnemyJungle; matchup.EnemyMid = matchupInfos.EnemyMid; matchup.EnemyAdc = matchupInfos.EnemyAdc; matchup.EnemySupport = matchupInfos.EnemySupport; if (matchupInfos.MatchupId == Guid.Empty) { matchup.MatchupId = Guid.NewGuid(); } else { matchup.MatchupId = matchupInfos.MatchupId; } matchup.PlayerId = matchupInfos.PlayerId; if (matchupInfos.MatchupResponseId == Guid.Empty) { matchup.MatchupResponseId = Guid.NewGuid(); } else { matchup.MatchupResponseId = matchupInfos.MatchupResponseId; } matchup.CreationDate = DateTime.Now; matchup.PatchVersion = matchupInfos.PatchVersion; if (String.IsNullOrEmpty(matchupInfos.PatchVersion)) { matchup.PatchVersion = ConfigurationManager.AppSettings["PatchVersion"]; } return(matchup); }
public List <MatchupInfos> ConvertMatchupsToMatchupInfos(List <Matchup> listMatchup, List <MatchupComment> listMatchupComment) { List <MatchupInfos> matchupInfos = new List <MatchupInfos>(); if (listMatchup?.Count > 0) { foreach (var matchup in listMatchup) { MatchupInfos matchupInfo = new MatchupInfos(); matchupInfo.MatchupId = matchup.MatchupId; matchupInfo.MatchupResponseId = matchup.MatchupResponseId; matchupInfo.AllyTop = matchup.AllyTop.Value; matchupInfo.AllyJungle = matchup.AllyJungle.Value; matchupInfo.AllyMid = matchup.AllyMid.Value; matchupInfo.AllyAdc = matchup.AllyAdc.Value; matchupInfo.AllySupport = matchup.AllySupport.Value; matchupInfo.EnemyTop = matchup.EnemyTop.Value; matchupInfo.EnemyJungle = matchup.EnemyJungle.Value; matchupInfo.EnemyMid = matchup.EnemyMid.Value; matchupInfo.EnemyAdc = matchup.EnemyAdc.Value; matchupInfo.EnemySupport = matchup.EnemySupport.Value; matchupInfo.PatchVersion = matchup.PatchVersion; var matchupResponse = db.MatchupResponses.Where(x => x.MatchupResponseId == matchup.MatchupResponseId); matchupInfo.Answers = new List <MatchupAnswer>(); foreach (var response in matchupResponse) { var matchupAnswer = new MatchupAnswer(); matchupAnswer.MatchupCommentId = response.MatchupResponseId; matchupAnswer.ChampionId = response.ChampionId; matchupAnswer.Comments = listMatchupComment.Where(x => x.MatchupId == matchup.MatchupId && x.ChampionId == response.ChampionId).OrderByDescending(x => x.CreationDate).FirstOrDefault()?.CommentText; matchupInfo.Answers.Add(matchupAnswer); } matchupInfo.Answers = matchupInfo.Answers.OrderBy(x => x.ChampionName).ToList(); matchupInfos.Add(matchupInfo); } } return(matchupInfos); }
public List <MatchupComment> buildMatchupCommentsEntity(MatchupInfos matchupInfos, Matchup matchup) { List <MatchupComment> matchupComments = new List <MatchupComment>(); if (matchupInfos.Answers?.Count > 0) { foreach (var comment in matchupInfos.Answers) { //var existingmatchupComment = db.MatchupComments.Where(x => x.MatchupId == matchupInfos.matchupId && x.ChampionId == comment.Id); MatchupComment matchupComment = new MatchupComment(); matchupComment.ChampionId = comment.ChampionId; matchupComment.CommentText = comment.Comments; matchupComment.PlayerId = matchup.PlayerId; matchupComment.MatchupCommentId = Guid.NewGuid(); matchupComment.CreationDate = DateTime.Now; matchupComment.MatchupId = matchup.MatchupId; matchupComments.Add(matchupComment); } } return(matchupComments); }
private MatchupInfos CreateAutomaticMatchupInfo(MatchupInfos matchupInfos, List <Guid> listMatchupResponse) { MatchupInfos automaticMatchupInfo = new MatchupInfos(); automaticMatchupInfo = matchupInfos.DuplicateMe(matchupInfos); automaticMatchupInfo.Answers = new List <MatchupAnswer>(); foreach (Guid matchupResponseId in listMatchupResponse) { var matchupResponses = db.MatchupResponses.Where(x => x.MatchupResponseId == matchupResponseId).ToList(); foreach (var matchupResponse in matchupResponses) { var matchupAnswer = new MatchupAnswer(); matchupAnswer.ChampionId = matchupResponse.ChampionId; if (!automaticMatchupInfo.Answers.Where(x => x.ChampionId == matchupResponse.ChampionId).Any()) { automaticMatchupInfo.Answers.Add(matchupAnswer); } } automaticMatchupInfo.Answers = automaticMatchupInfo.Answers.OrderBy(x => x.ChampionName).ToList(); } return(automaticMatchupInfo); }
private IEnumerable <Matchup> GetEstimatedAnswersAsToplaner(Player player, MatchupInfos matchupInfos) { IEnumerable <Matchup> listMatchup = Enumerable.Empty <Matchup>().AsQueryable(); // les 3 param if (matchupInfos.EnemyTop != Guid.Empty && matchupInfos.EnemyJungle != Guid.Empty && matchupInfos.AllyJungle != Guid.Empty) { listMatchup = db.Matchups.Where(x => x.PlayerId == matchupInfos.PlayerId); listMatchup = listMatchup.Where(x => x.AllyTop == Guid.Empty); listMatchup = listMatchup.Where(x => x.AllyJungle == matchupInfos.AllyJungle); listMatchup = listMatchup.Where(x => x.AllyMid == Guid.Empty); listMatchup = listMatchup.Where(x => x.AllyAdc == Guid.Empty); listMatchup = listMatchup.Where(x => x.AllySupport == Guid.Empty); listMatchup = listMatchup.Where(x => x.EnemyTop == matchupInfos.EnemyTop); listMatchup = listMatchup.Where(x => x.EnemyJungle == matchupInfos.EnemyJungle); listMatchup = listMatchup.Where(x => x.EnemyMid == Guid.Empty); listMatchup = listMatchup.Where(x => x.EnemyAdc == Guid.Empty); listMatchup = listMatchup.Where(x => x.EnemySupport == Guid.Empty); } //sans le jungler allié else if (matchupInfos.EnemyTop != Guid.Empty && matchupInfos.EnemyJungle != Guid.Empty && matchupInfos.AllyJungle == Guid.Empty) { listMatchup = db.Matchups.Where(x => x.PlayerId == matchupInfos.PlayerId); listMatchup = listMatchup.Where(x => x.AllyTop == Guid.Empty); listMatchup = listMatchup.Where(x => x.AllyJungle == Guid.Empty); listMatchup = listMatchup.Where(x => x.AllyMid == Guid.Empty); listMatchup = listMatchup.Where(x => x.AllyAdc == Guid.Empty); listMatchup = listMatchup.Where(x => x.AllySupport == Guid.Empty); listMatchup = listMatchup.Where(x => x.EnemyTop == matchupInfos.EnemyTop); listMatchup = listMatchup.Where(x => x.EnemyJungle == matchupInfos.EnemyJungle); listMatchup = listMatchup.Where(x => x.EnemyMid == Guid.Empty); listMatchup = listMatchup.Where(x => x.EnemyAdc == Guid.Empty); listMatchup = listMatchup.Where(x => x.EnemySupport == Guid.Empty); } //sans le jungler Enemy else if (matchupInfos.EnemyTop != Guid.Empty && matchupInfos.EnemyJungle == Guid.Empty && matchupInfos.AllyJungle != Guid.Empty) { listMatchup = db.Matchups.Where(x => x.PlayerId == matchupInfos.PlayerId); listMatchup = listMatchup.Where(x => x.AllyTop == Guid.Empty); listMatchup = listMatchup.Where(x => x.AllyJungle == matchupInfos.AllyJungle); listMatchup = listMatchup.Where(x => x.AllyMid == Guid.Empty); listMatchup = listMatchup.Where(x => x.AllyAdc == Guid.Empty); listMatchup = listMatchup.Where(x => x.AllySupport == Guid.Empty); listMatchup = listMatchup.Where(x => x.EnemyTop == matchupInfos.EnemyTop); listMatchup = listMatchup.Where(x => x.EnemyJungle == Guid.Empty); listMatchup = listMatchup.Where(x => x.EnemyMid == Guid.Empty); listMatchup = listMatchup.Where(x => x.EnemyAdc == Guid.Empty); listMatchup = listMatchup.Where(x => x.EnemySupport == Guid.Empty); } // sans le jungler allié et Enemy else if (matchupInfos.EnemyTop != Guid.Empty && matchupInfos.EnemyJungle == Guid.Empty && matchupInfos.AllyJungle == Guid.Empty) { listMatchup = db.Matchups.Where(x => x.PlayerId == matchupInfos.PlayerId); listMatchup = listMatchup.Where(x => x.AllyTop == Guid.Empty); listMatchup = listMatchup.Where(x => x.AllyJungle == Guid.Empty); listMatchup = listMatchup.Where(x => x.AllyMid == Guid.Empty); listMatchup = listMatchup.Where(x => x.AllyAdc == Guid.Empty); listMatchup = listMatchup.Where(x => x.AllySupport == Guid.Empty); listMatchup = listMatchup.Where(x => x.EnemyTop == matchupInfos.EnemyTop); listMatchup = listMatchup.Where(x => x.EnemyJungle == Guid.Empty); listMatchup = listMatchup.Where(x => x.EnemyMid == Guid.Empty); listMatchup = listMatchup.Where(x => x.EnemyAdc == Guid.Empty); listMatchup = listMatchup.Where(x => x.EnemySupport == Guid.Empty); } return(listMatchup); }
public MatchupInfos GetEstimatedAnswersByMatchupParam(MatchupInfos matchupInfos) { var player = new DAL().getPlayerById(matchupInfos.PlayerId); IEnumerable <Matchup> listMatchup = GetListMatchupByRole(player, matchupInfos); bool hasFilter = false; if (listMatchup.Count() == 0) { listMatchup = Enumerable.Empty <Matchup>().AsQueryable(); //ALLY if (matchupInfos.AllyTop != Guid.Empty) { if (listMatchup.Count() > 0) { var tempList = listMatchup.Where(x => x.AllyTop == matchupInfos.AllyTop && x.PlayerId == matchupInfos.PlayerId); if (tempList.Count() > 0) { listMatchup = listMatchup.Intersect(tempList).ToList(); } } else { listMatchup = db.Matchups.Where(x => x.AllyTop == matchupInfos.AllyTop && x.PlayerId == matchupInfos.PlayerId).ToList(); } hasFilter = true; } if (matchupInfos.AllyJungle != Guid.Empty) { if (listMatchup.Count() > 0) { var tempList = listMatchup.Where(x => x.AllyJungle == matchupInfos.AllyJungle && x.PlayerId == matchupInfos.PlayerId); if (tempList.Count() > 0) { listMatchup = listMatchup.Intersect(tempList).ToList(); } } else { listMatchup = db.Matchups.Where(x => x.AllyJungle == matchupInfos.AllyJungle && x.PlayerId == matchupInfos.PlayerId); } hasFilter = true; } if (matchupInfos.AllyMid != Guid.Empty) { if (listMatchup.Count() > 0) { var tempList = listMatchup.Where(x => x.AllyMid == matchupInfos.AllyMid && x.PlayerId == matchupInfos.PlayerId); if (tempList.Count() > 0) { listMatchup = listMatchup.Intersect(tempList); } } else { listMatchup = db.Matchups.Where(x => x.AllyMid == matchupInfos.AllyMid && x.PlayerId == matchupInfos.PlayerId); } hasFilter = true; } if (matchupInfos.AllyAdc != Guid.Empty) { if (listMatchup.Count() > 0) { var tempList = listMatchup.Where(x => x.AllyAdc == matchupInfos.AllyAdc && x.PlayerId == matchupInfos.PlayerId); if (tempList.Count() > 0) { listMatchup = listMatchup.Intersect(tempList); } } else { listMatchup = db.Matchups.Where(x => x.AllyAdc == matchupInfos.AllyAdc && x.PlayerId == matchupInfos.PlayerId); } hasFilter = true; } if (matchupInfos.AllySupport != Guid.Empty) { if (listMatchup.Count() > 0) { var tempList = listMatchup.Where(x => x.AllySupport == matchupInfos.AllySupport && x.PlayerId == matchupInfos.PlayerId); if (tempList.Count() > 0) { listMatchup = listMatchup.Intersect(tempList); } } else { listMatchup = db.Matchups.Where(x => x.AllySupport == matchupInfos.AllySupport && x.PlayerId == matchupInfos.PlayerId); } hasFilter = true; } //ENNEMI if (matchupInfos.EnemyTop != Guid.Empty) { if (listMatchup.Count() > 0) { var tempList = listMatchup.Where(x => x.EnemyTop == matchupInfos.EnemyTop && x.PlayerId == matchupInfos.PlayerId); if (tempList.Count() > 0) { listMatchup = listMatchup.Intersect(tempList); } } else { listMatchup = db.Matchups.Where(x => x.EnemyTop == matchupInfos.EnemyTop && x.PlayerId == matchupInfos.PlayerId); } hasFilter = true; } if (matchupInfos.EnemyJungle != Guid.Empty) { if (listMatchup.Count() > 0) { var tempList = listMatchup.Where(x => x.EnemyJungle == matchupInfos.EnemyJungle && x.PlayerId == matchupInfos.PlayerId); if (tempList.Count() > 0) { listMatchup = listMatchup.Intersect(tempList); } } else { listMatchup = db.Matchups.Where(x => x.EnemyJungle == matchupInfos.EnemyJungle && x.PlayerId == matchupInfos.PlayerId); } hasFilter = true; } if (matchupInfos.EnemyMid != Guid.Empty) { if (listMatchup.Count() > 0) { var tempList = listMatchup.Where(x => x.EnemyMid == matchupInfos.EnemyMid && x.PlayerId == matchupInfos.PlayerId); if (tempList.Count() > 0) { listMatchup = listMatchup.Intersect(tempList); } } else { listMatchup = db.Matchups.Where(x => x.EnemyMid == matchupInfos.EnemyMid && x.PlayerId == matchupInfos.PlayerId); } hasFilter = true; } if (matchupInfos.EnemyAdc != Guid.Empty) { if (listMatchup.Count() > 0) { var tempList = listMatchup.Where(x => x.EnemyAdc == matchupInfos.EnemyAdc && x.PlayerId == matchupInfos.PlayerId); if (tempList.Count() > 0) { listMatchup = listMatchup.Intersect(tempList); } } else { listMatchup = db.Matchups.Where(x => x.EnemyAdc == matchupInfos.EnemyAdc && x.PlayerId == matchupInfos.PlayerId); } hasFilter = true; } if (matchupInfos.EnemySupport != Guid.Empty) { if (listMatchup.Count() > 0) { var tempList = listMatchup.Where(x => x.EnemySupport == matchupInfos.EnemySupport && x.PlayerId == matchupInfos.PlayerId); if (tempList.Count() > 0) { listMatchup = listMatchup.Intersect(tempList); } } else { listMatchup = db.Matchups.Where(x => x.EnemySupport == matchupInfos.EnemySupport && x.PlayerId == matchupInfos.PlayerId); } hasFilter = true; } } else { hasFilter = true; } var automaticMatchupInfos = new MatchupInfos(); if (hasFilter && listMatchup.Count() > 0) { //recuperer la liste das matchupResponsesId pour recuperer la liste des champions var listMatchupResponse = listMatchup.Select(x => x.MatchupResponseId).ToList(); automaticMatchupInfos = CreateAutomaticMatchupInfo(matchupInfos, listMatchupResponse); } return(automaticMatchupInfos); }
public Tuple <List <MatchupInfos>, long, MatchupInfos> getAllMatchupByParams(Guid playerId, MatchupInfos matchupInfos) { List <MatchupInfos> listMatchupInfos = new List <MatchupInfos>(); var dalCalculation = new DALCalculation(); var listMatchup = db.Matchups.Where(x => x.PlayerId == playerId); bool hasFilter = false; //ALLY if (matchupInfos.AllyTop != Guid.Empty) { listMatchup = listMatchup.Where(x => x.AllyTop == matchupInfos.AllyTop); hasFilter = true; } if (matchupInfos.AllyJungle != Guid.Empty) { listMatchup = listMatchup.Where(x => x.AllyJungle == matchupInfos.AllyJungle); hasFilter = true; } if (matchupInfos.AllyMid != Guid.Empty) { listMatchup = listMatchup.Where(x => x.AllyMid == matchupInfos.AllyMid); hasFilter = true; } if (matchupInfos.AllyAdc != Guid.Empty) { listMatchup = listMatchup.Where(x => x.AllyAdc == matchupInfos.AllyAdc); hasFilter = true; } if (matchupInfos.AllySupport != Guid.Empty) { listMatchup = listMatchup.Where(x => x.AllySupport == matchupInfos.AllySupport); hasFilter = true; } //ENNEMI if (matchupInfos.EnemyTop != Guid.Empty) { listMatchup = listMatchup.Where(x => x.EnemyTop == matchupInfos.EnemyTop); hasFilter = true; } if (matchupInfos.EnemyJungle != Guid.Empty) { listMatchup = listMatchup.Where(x => x.EnemyJungle == matchupInfos.EnemyJungle); hasFilter = true; } if (matchupInfos.EnemyMid != Guid.Empty) { listMatchup = listMatchup.Where(x => x.EnemyMid == matchupInfos.EnemyMid); hasFilter = true; } if (matchupInfos.EnemyAdc != Guid.Empty) { listMatchup = listMatchup.Where(x => x.EnemyAdc == matchupInfos.EnemyAdc); hasFilter = true; } if (matchupInfos.EnemySupport != Guid.Empty) { listMatchup = listMatchup.Where(x => x.EnemySupport == matchupInfos.EnemySupport); hasFilter = true; } bool isPerfectMatch = dalCalculation.isPerfectMatchupExistWithMatchupInfo(matchupInfos, playerId); long time; var automaticMatchup = new MatchupInfos(); if (true) { var listMatchupComment = db.MatchupComments.Where(x => x.PlayerId == playerId).ToList(); Stopwatch t0 = new Stopwatch(); t0.Start(); var listMatchups = listMatchup.OrderByDescending(x => x.CreationDate).ThenBy(x => x.PatchVersion).Take(200).ToList(); time = t0.ElapsedMilliseconds; listMatchupInfos = ConvertMatchupsToMatchupInfos(listMatchups, listMatchupComment); if (!isPerfectMatch) { matchupInfos.PlayerId = playerId; automaticMatchup = dalCalculation.GetEstimatedAnswersByMatchupParam(matchupInfos); } var t2 = t0.ElapsedMilliseconds; } return(new Tuple <List <MatchupInfos>, long, MatchupInfos>(listMatchupInfos, time, automaticMatchup)); }
public MatchupInfos GetEstimatedAnswersWithAllParam(MatchupInfos matchupInfos) { IQueryable <Matchup> listMatchup = db.Matchups.Where(x => x.PlayerId == matchupInfos.PlayerId); List <Matchup> calcultedList = new List <Matchup>(); bool hasFilter = false; //ALLY if (matchupInfos.AllyTop != Guid.Empty) { calcultedList = calcultedList.Union(listMatchup.Where(x => x.AllyTop == matchupInfos.AllyTop)).ToList(); hasFilter = true; } if (matchupInfos.AllyJungle != Guid.Empty) { calcultedList = calcultedList.Union(listMatchup.Where(x => x.AllyJungle == matchupInfos.AllyJungle)).ToList(); hasFilter = true; } if (matchupInfos.AllyMid != Guid.Empty) { calcultedList = calcultedList.Union(listMatchup.Where(x => x.AllyMid == matchupInfos.AllyMid)).ToList(); hasFilter = true; } if (matchupInfos.AllyAdc != Guid.Empty) { calcultedList = calcultedList.Union(listMatchup.Where(x => x.AllyAdc == matchupInfos.AllyAdc)).ToList(); hasFilter = true; } if (matchupInfos.AllySupport != Guid.Empty) { calcultedList = calcultedList.Union(listMatchup.Where(x => x.AllySupport == matchupInfos.AllySupport)).ToList(); hasFilter = true; } //ENNEMI if (matchupInfos.EnemyTop != Guid.Empty) { calcultedList = calcultedList.Union(listMatchup.Where(x => x.EnemyTop == matchupInfos.EnemyTop)).ToList(); hasFilter = true; } if (matchupInfos.EnemyJungle != Guid.Empty) { calcultedList = calcultedList.Union(listMatchup.Where(x => x.EnemyJungle == matchupInfos.EnemyJungle)).ToList(); hasFilter = true; } if (matchupInfos.EnemyMid != Guid.Empty) { calcultedList = calcultedList.Union(listMatchup.Where(x => x.EnemyMid == matchupInfos.EnemyMid)).ToList(); hasFilter = true; } if (matchupInfos.EnemyAdc != Guid.Empty) { calcultedList = calcultedList.Union(listMatchup.Where(x => x.EnemyAdc == matchupInfos.EnemyAdc)).ToList(); hasFilter = true; } if (matchupInfos.EnemySupport != Guid.Empty) { calcultedList = calcultedList.Union(listMatchup.Where(x => x.EnemySupport == matchupInfos.EnemySupport)).ToList(); hasFilter = true; } //recuperer la liste das matchupResponsesId pour recuperer la liste des champions var listMatchupResponse = calcultedList.Select(x => x.MatchupResponseId).ToList(); var automaticMatchupInfos = new MatchupInfos(); automaticMatchupInfos = CreateAutomaticMatchupInfo(matchupInfos, listMatchupResponse); //listMatchupInfos.Add(listMatchup); // return(automaticMatchupInfos); }