/// <summary> /// Sets the needed information for our new InstinctGuildMember Model. /// </summary> /// <param name="oldModel">The ArgentPonyWarcraftClient GuildMember Model</param> /// <returns>The new InstinctGuildMember model with all the set information</returns> public InstinctGuildMember ConvertGuildMemberModel(GuildMember oldModel, PlayableClassesIndex classIndex, PlayableRacesIndex raceIndex) { InstinctGuildMember instinctMember = new InstinctGuildMember(); instinctMember.Level = oldModel.Character.Level; instinctMember.Name = oldModel.Character.Name; instinctMember.PlayableClass = SetCorrectPlayableClassName(oldModel, classIndex); instinctMember.PlayableRace = SetCorrectPlayableRaceName(oldModel, raceIndex); instinctMember.Realm = ToUpperFirst(oldModel.Character.Realm.Slug); instinctMember.RankName = SetCorrectRankName(oldModel); return(instinctMember); }
/// <returns>A list of all guild members.</returns> public List <InstinctGuildMember> PrepareGuildMembersList() { List <GuildMember> warcraftGuildMembers = _warcraftClient.GetGuildRosterAsync("draenor", "perplexed", "profile-eu") .Result.Value.Members.OrderBy(members => members.Rank) .ThenBy(members => members.Character.Name) .ToList(); // We call the raceIndex and the classIndex here to reduce the total amount of API calls. PlayableRacesIndex raceIndex = _warcraftClient.GetPlayableRacesIndexAsync("static-eu").Result.Value; PlayableClassesIndex classIndex = _warcraftClient.GetPlayableClassesIndexAsync("static-eu").Result.Value; // We create a new list with our own model of InstinctGuildMembers List <InstinctGuildMember> instinctGuildMembers = new List <InstinctGuildMember>(); foreach (GuildMember member in warcraftGuildMembers) { InstinctGuildMember newModel = ConvertGuildMemberModel(member, classIndex, raceIndex); instinctGuildMembers.Add(newModel); } return(instinctGuildMembers); }