Exemple #1
0
        public IActionResult CloseSession(string sessionid)
        {
            IActionResult response = null;;
            Session       session  = sessionContext.FindSession(sessionid);

            if (session != null)
            {
                if (sessionContext.CloseSession(sessionid))
                {
                    logger.LogInformation($"Session closed OK: {sessionid}");
                    response = Ok();
                }
                else
                {
                    logger.LogInformation($"Session closed Failed: {sessionid}");
                    response = StatusCode((int)HttpStatusCode.PreconditionFailed);
                }
            }
            else
            {
                logger.LogInformation($"CloseSession: Session Not Found: {sessionid}");
                response = StatusCode((int)HttpStatusCode.NotFound);
            }

            return(response);
        }
Exemple #2
0
        public HttpResponseMessage CloseSession(string sessionid)
        {
            HttpResponseMessage response = new HttpResponseMessage();
            Session             session  = sessionContext.FindSession(sessionid);

            if (session != null)
            {
                if (sessionContext.CloseSession(sessionid))
                {
                    response.StatusCode = HttpStatusCode.OK;
                }
                else
                {
                    response.StatusCode = HttpStatusCode.PreconditionFailed;
                }
            }
            else
            {
                response.StatusCode = HttpStatusCode.NotFound;
            }

            return(response);
        }