Ejemplo n.º 1
0
        public override Task <PlayerReply> GetPlayer(PlayerRequest request, Grpc.Core.ServerCallContext context)
        {
            _logger.LogInformation("Querying for player...");

            var Player = _Db.GetPlayers()
                         .Where(candidate => String.Equals(candidate.Name, request.Name, StringComparison.OrdinalIgnoreCase))
                         .FirstOrDefault();

            var wrapReply = new PlayerReply {
                Message = $"Could not find Player {request.Name}"
            };

            if (Player != null)
            {
                wrapReply = new PlayerReply {
                    Message = $"Found {request.Name}",
                    Player  = Player
                };
            }
            return(Task.FromResult(wrapReply));
        }
Ejemplo n.º 2
0
 private IEnumerable <Player> GetPlayersFromCountry(string country)
 {
     return(_Db.GetPlayers()
            .Where((Player candidate) => (String.Equals(country, candidate.Country, StringComparison.OrdinalIgnoreCase))));
 }