Exemple #1
0
        public async Task <IHttpActionResult> GetStatus(string preAuthorizedKey = null)
        {
            // Check pre-authorized key
            // Refactoring for shorter status as per US955

            if (preAuthorizedKey != null && preAuthorizedKey != _expectedPreAuthorizedKey)
            {
                return(ResponseMessage(Request.CreateResponse(HttpStatusCode.Unauthorized, "Unauthorized", new MediaTypeHeaderValue("application/json"))));
            }

            ServiceStatus serviceStatus = await _statusControllerHelper.GetStatus();

            if (preAuthorizedKey == null)
            {
                serviceStatus = _statusControllerHelper.GetShorterStatus(serviceStatus);
            }

            if (serviceStatus.NoErrors)
            {
                return(Ok(serviceStatus));
            }
            else
            {
                var response = Request.CreateResponse(HttpStatusCode.InternalServerError, serviceStatus);
                return(ResponseMessage(response));
            }
        }
Exemple #2
0
        public async Task <IHttpActionResult> GetStatus(string preAuthorizedKey = null)
        {
            ServiceStatus serviceStatus = await _statusControllerHelper.GetStatus();

            if (preAuthorizedKey == null)
            {
                serviceStatus = _statusControllerHelper.GetShorterStatus(serviceStatus);
            }
            if (serviceStatus.NoErrors)
            {
                return(Ok(serviceStatus));
            }
            else
            {
                var response = Request.CreateResponse(HttpStatusCode.InternalServerError, serviceStatus);
                return(ResponseMessage(response));
            }
        }