-3
I have the following code is I want to get a return on the result variable if it is true or false, how could I do it?
//http://localhost:1608/api/ApiCidade/deletar/cliente/10
[HttpDelete]
[Route("deletar/cliente/{id:int}")]
public HttpResponseMessage ClienteDeletar(int id)
{
try
{
var resultado = true;
var tCliente = new ClienteAplicacao();
tCliente.Excluir(id);
return Request.CreateResponse(HttpStatusCode.OK, resultado);
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message);
}
}
In the App I have:
public void Excluir(int id)
{
var strQuery = string.Format("DELETE FROM clientes WHERE id= {0}", id);
using (contexto = new Contexto())
{
contexto.ExecutaComando(strQuery);
}
}
I don’t understand what you want.
– Maniero
this duplicate [ http://answall.com/questions/96643/howto returnr-consulta-por-uma-string-usando-webapi]
– Marco Souza
[http://answall.com/questions/96643/como-retornar-consulta-por-uma-string-usando-webapi]
– Marco Souza
And what would be the criteria for
true
orfalse
? Return from where?– Randrade