public IActionResult GetAllRequestsPerDayByUserId([FromQuery] string developerId, [FromQuery] DateTime?fromDate, [FromQuery] DateTime?toDate) { try { string UserId = string.Empty; #region Auth request if (Request.Headers.TryGetValue("Authorization", out StringValues headerValues)) { UserId = headerValues.FirstOrDefault(); } else { return(BadRequest("Not Authorized")); } #endregion if (String.IsNullOrEmpty(developerId)) { return(BadRequest("Incorrect developerId")); } var userId = MongoConnector.GetUserIdFromUserEmail(new GetUserIdRequestModel { UserEmail = developerId }); if (userId.IsError) { return(BadRequest(userId.Message)); } if (fromDate == null) { fromDate = Kitsune.API2.EnvConstants.Constants.epoch; } if (toDate == null) { toDate = DateTime.UtcNow; } var projects = MongoConnector.GetAllProjectsPerUser(developerId); var websites = MongoConnector.GetAllCustomerIdsPerDeveloperId(userId.Id); return(Json(new MySQLConnector().GetAllRequestsPerDayByUserId(projects, websites, fromDate, toDate))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }