Example #1
0
        public HttpResponseMessage UnavailablePost([FromBody] AgentParameters agent)
        {
            try
            {
                if (MainObject.MainList.ContainsKey(agent.User.AgentId))
                {
                    CApp            mpApp  = MainObject.MainList[agent.User.AgentId];
                    CNotReadyReason reason = new CNotReadyReason(agent.Unavailable.Id, agent.Unavailable.Description);
                    bool            park   = agent.Unavailable.Park;

                    mpApp.BecomeUnavailable(reason, park);
                    return(Request.CreateResponse(HttpStatusCode.OK, "Unavailable (OK)"));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound, "Agent Not Found"));
                }
            }
            catch (Exception ex)
            {
                Log.logException(ex);
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
            }
        }