예제 #1
0
        public async Task <IEnumerable <GameStatisticsModel> > GamesWonByPlayer(string name)
        {
            //if (string.IsNullOrEmpty(name)) return new EmptyResult();

            var matches = _matchService.FindAllMatches().Where(x => x.Winner.Name.Contains(name)).ToList();

            if (!matches.Any())
            {
                return(null);
            }

            return(matches.Select(match => new GameStatisticsModel
            {
                WinnerName = match.Winner.Name,
                LoserName = match.Loser.Name
            }));
        }