Example #1
0
        public async Task <ActionResult> GetAllCoffees(bool includeCofeeAreas)
        {
            try
            {
                using (_cofeelogger.BeginScope($"API-GetAllCoffees-Inititating {DateTime.UtcNow}"))
                {
                    var result = await _coffeeService.GetAllCoffees(includeCofeeAreas).ConfigureAwait(false);

                    _cofeelogger.LogInformation($"API-GetAllCoffees-Completed {DateTime.UtcNow}");

                    return(StatusCode((int)result.statusCode, result.coffeeDtos));
                }
            }
            catch (Exception ex)
            {
                _cofeelogger.LogError
                    (ex,
                    $"API-GetAllCoffees-Exception {DateTime.UtcNow}"
                    );

                return(StatusCode((int)HttpStatusCode.BadRequest,
                                  _apiSettings.IsSecuredEnvironment ? "An error occured while processing GetAllCoffees" : ex.ToString()));
            }
        }