Ejemplo n.º 1
0
        public IActionResult StartHeavyCalc(StartHeavyCalcRequest request)
        {
            IActionResult response = null;

            logger.LogInformation($"Call to heavycalc for {request.FileName}");

            validateStrParam("sessionid", request.SessionId);
            validateStrParam("filename", request.FileName);

            if (!isValidSession(request.SessionId))
            {
                logger.LogError($"Invalid session tocken {request.SessionId}");
                throw new ArgumentException(string.Format("Invalid session toekn: {0}", request.SessionId));
            }

            logger.LogInformation($"Sending message for {request.FileName}");

            sendStartMessage(request.FileName);

            StartHeavyCalcResponse respContent = new StartHeavyCalcResponse()
            {
                IsStarted = true,
                StartedDt = DateTime.UtcNow
            };

            response = Ok(JsonConvert.SerializeObject(respContent, Formatting.Indented));

            return(response);
        }
Ejemplo n.º 2
0
        public HttpResponseMessage StartHeavyCalc(StartHeavyCalcRequest request)
        {
            HttpResponseMessage response = new HttpResponseMessage();

            validateStrParam("sessionid", request.SessionId);
            validateStrParam("filename", request.FileName);

            if (!isValidSession(request.SessionId))
            {
                throw new ArgumentException(string.Format("Invalid session toekn: {0}", request.SessionId));
            }

            sendStartMessage(request.FileName);

            StartHeavyCalcResponse respContent = new StartHeavyCalcResponse()
            {
                IsStarted = true,
                StartedDt = DateTime.UtcNow
            };

            response.Content = new StringContent(JsonConvert.SerializeObject(respContent));

            return(response);
        }