示例#1
0
        public HttpResponseMessage Post(Client client)
        {
            RespostaErro erro = new RespostaErro();

            erro = Comercial.InsertClientObj(client);
            Put(client);

            if (erro.Erro == 0)
            {
                var response = Request.CreateResponse(
                    HttpStatusCode.Created, client);
                string uri = Url.Link("ActionApi", new { CodCliente = client.CodCliente });
                response.Headers.Location = new Uri(uri);
                return(response);
            }

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