public IActionResult GetMonthlySearchAnalytics([FromQuery] string websiteId, [FromQuery] int year) { try { if (string.IsNullOrWhiteSpace(websiteId)) { return(BadRequest()); } DateTime dt; try { dt = new DateTime(year, 1, 1); } catch (Exception) { return(BadRequest()); } var searchAnalyticsDict = MySQLConnector.GetMonthlySearchAnalytics(new string[] { websiteId }, dt.Year); 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)); }