public async Task <IActionResult> Prices([FromServices] IPrices prices, string securityId, DateTime?forDate = null, int dayCount = 5) { try { var runDate = forDate ?? DateTime.Today.Date; Logger.LogInformation(default(EventId), message: $"Retrieving Prices for {runDate}; security: {securityId}; for days: {dayCount}."); var result = await prices .GetPriceRecords(securityId, runDate, dayCount) .ConfigureAwait(false); Logger.LogInformation(default(EventId), message: $"Exit Prices: retrieved {result.Count} records."); return(new OkObjectResult(result)); } catch (Exception ex) { Logger.LogError(default(EventId), message: "Unexpected Exception:", exception: ex); return(this.StatusCode(500, $"Unexpected Exception: {ex}")); } }