private List <SoccerTableEntryViewModel> Convert(SoccerTable soccerTable) { var result = new List <SoccerTableEntryViewModel>(); for (int index = 0; index < soccerTable.Entries.Length; index++) { var current = soccerTable.Entries[index]; var item = new SoccerTableEntryViewModel { Position = index + 1, TeamName = current.Team.Name, TeamLogo = current.Team.Logo, NumberOfMatches = current.NumberOfMatches, NumberOfPoints = current.NumberOfPoints, NumberOfWonMatches = current.NumberOfWonMatches, NumberOfDrawMatches = current.NumberOfDrawMatches, NumberOfLostMatches = current.NumberOfLostMatches, NumberOfGoals = current.NumberOfGoals, NumberOfOpponentGoals = current.NumberOfOpponentGoals, GoalsDifference = current.NumberOfGoals - current.NumberOfOpponentGoals, }; result.Add(item); } return(result); }
public void GetTable(Action <SoccerTable, Exception> callback) { var result = new SoccerTable { Entries = new[] { new SoccerTableEntry { Team = new SoccerTeam { Name = "FC Bayern München", ShortName = "München", Id = 13, }, NumberOfMatches = 34, NumberOfPoints = 84, NumberOfWonMatches = 27, NumberOfDrawMatches = 3, NumberOfLostMatches = 4, NumberOfGoals = 92, NumberOfOpponentGoals = 28, }, new SoccerTableEntry { Team = new SoccerTeam { Name = "FC Schalke 04", ShortName = "Schalke", Id = 12, }, NumberOfMatches = 34, NumberOfPoints = 63, NumberOfWonMatches = 18, NumberOfDrawMatches = 9, NumberOfLostMatches = 7, NumberOfGoals = 53, NumberOfOpponentGoals = 37, }, } }; callback(result, null); }