// GET Encomenda/:id
 public Models.Encomenda Get(string id)
 {
     Models.Encomenda encomenda = Lib_Primavera.PriIntegration.get_sale(id);
     if (encomenda == null)
     {
         throw new HttpResponseException(
                   Request.CreateResponse(HttpStatusCode.NotFound));
     }
     else
     {
         return(encomenda);
     }
 }
        // POST Encomenda/
        public HttpResponseMessage Post(Models.Encomenda encomenda)
        {
            Models.RespostaErro erro = new Models.RespostaErro();
            erro = Lib_Primavera.PriIntegration.new_sale(encomenda);

            if (erro.Erro == 0)
            {
                encomenda.Id = (string)erro.Data;
                var response = Request.CreateResponse(HttpStatusCode.Created, encomenda);
                return(response);
            }

            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }