Ejemplo n.º 1
0
        public async Task <IActionResult> Index([FromQuery] int?age = null)
        {
            GuestListResponse response;

            if (age == null)
            {
                response = await _guestService.GetGuestsAsync();
            }
            else
            {
                response = await _guestService.GetGuestsByAgeAsync(age.Value);
            }

            if (!response.Result)
            {
                _logger.LogInformation($"An error occured during retrieving guests list.");
                return(BadRequest(response));
            }

            _logger.LogInformation("Guests list successfully retrieved.");
            return(new OkObjectResult(response));
        }