public IActionResult GetDailySearchAnalytics([FromQuery] string websiteId, [FromQuery] int year, [FromQuery] int month) { try { if (string.IsNullOrWhiteSpace(websiteId)) { return(BadRequest()); } DateTime dt; try { dt = new DateTime(year, month, 1); } catch (Exception) { return(BadRequest()); } var searchAnalyticsDict = MySQLConnector.GetDailySearchAnalytics(new string[] { websiteId }, dt.Year, dt.Month); if (searchAnalyticsDict?.ContainsKey(websiteId) == true) { if (searchAnalyticsDict[websiteId]?.Count > 0) { return(Ok(searchAnalyticsDict[websiteId])); } } } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e)); } return(Ok(null)); }