Пример #1
0
        // POST api/leads/
        // FEATURE: Adicionar lead
        public HttpResponseMessage Post([FromBody] LeadInfo jsonObject)
        {
            if (Authentication.VerifyToken("?"))
            {
                try
                {
                    var operationResult = LeadIntegration.Insert(Authentication.GetRepresentative(null), jsonObject);

                    if (operationResult == null)
                    {
                        return(Request.CreateResponse(HttpStatusCode.NotFound));
                    }
                    else
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, operationResult));
                    }
                }
                catch (Exception ex)
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
                }
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.Forbidden));
            }
        }