public int GetClientRankingsByShard(Guid shardId, Guid characterId) { Bounty bounty = new Bounty(); var topPlayers = new List<TopPlayers>(); // Find all characters for the provided shardid IEnumerable<Character> characterList = this.db.Characters.Where(c => c.ShardId == shardId); // get placed count for each character foreach (Character characterListItem in characterList) { topPlayers.Add(new TopPlayers { CharacterId = characterListItem.Id, count = bounty.GetBountiesPlacedCount(characterListItem.Id) }); } // sort by killed count List<TopPlayers> sortedTopPlayers = topPlayers.OrderBy(c => c.count).ThenBy(c => c.CharacterId).Reverse().ToList(); // find position in the list return (sortedTopPlayers.IndexOf(sortedTopPlayers.Where(c => c.CharacterId == characterId).Single()) + 1); }
public int GetBountiesPlacedCount(Guid characterId) { Bounty bounty = new Bounty(); return bounty.GetBountiesPlacedCount(characterId); }