public IActionResult GetDetailedSearchAnalyticsForDate([FromQuery] string websiteId, [FromQuery] int year, [FromQuery] int month, [FromQuery] int day) { try { if (string.IsNullOrWhiteSpace(websiteId)) { return(BadRequest()); } DateTime dt; try { dt = new DateTime(year, month, day); } catch (Exception) { return(BadRequest()); } List <DetailedSearchAnalytics> detailedSearchAnalytics = MySQLConnector.GetDetailedSearchAnalytics(websiteId, dt, dt.AddDays(1)); if (detailedSearchAnalytics != null) { return(Ok(detailedSearchAnalytics)); } } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e)); } return(Ok(null)); }
public IActionResult GetDetailedSearchAnalyticsForDateRange([FromQuery] string websiteId, [FromQuery] DateTime startDate, [FromQuery] DateTime endDate) { try { if (string.IsNullOrWhiteSpace(websiteId)) { return(BadRequest()); } List <DetailedSearchAnalytics> detailedSearchAnalytics = MySQLConnector.GetDetailedSearchAnalytics(websiteId, startDate, endDate); if (detailedSearchAnalytics != null) { return(Ok(detailedSearchAnalytics)); } } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e)); } return(Ok(null)); }