1
I have a method that makes the record insertion, after having inserted precise return the id that was recorded, more is not returning the information. I appreciate the help.
[HttpGet]
[Route("consulta/InseriUsuario/{apiKey}/{userKey}/{nomecompleto}/{email}/{login}/{senha}/{celular}/{cidade}/{uf}/{idperfil}/{idpais}/{ididioma}")]
public HttpResponseMessage InseriUsuario(string apiKey, string userKey, string NOMECOMPLETO, string EMAIL, string LOGIN, string SENHA, string CELULAR, string CIDADE, string UF, int IDPERFIL, int IDPAIS, int IDIDIOMA )
{
try
{
var tTabela = new UsuarioAplicacao();
tTabela.InseriUsuario(apiKey, userKey, NOMECOMPLETO, EMAIL, CELULAR, CIDADE, UF, LOGIN, SENHA, IDPERFIL, IDPAIS, IDIDIOMA );
return Request.CreateResponse(HttpStatusCode.OK, tTabela.ToString());
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message);
}
}
public string InseriUsuario(string apiKey, string userKey, string NOMECOMPLETO, string EMAIL, string CELULAR, string CIDADE, string UF, string LOGIN, string SENHA, int IDPERFIL, int IDPAIS, int IDIDIOMA )
{
var retorno = 0;
var strQuery = "";
//insert normal
using (contexto = new Contexto())
{
var reader = contexto.ExecutaComandoComRetorno(strQuery);
while (reader.Read())
{
retorno = Convert.ToInt32(reader["IDUSUARIO"]);
}
reader.Close();
}
}
else
{
strQuery = "select * from TB_USUARIO where IDUSUARIO = 0";
}
return retorno.ToString();
}
Rovann, very grateful for the help, worked out, made the adjustment Return Request.Createresponse(Httpstatuscode.OK, new { usuario = codeInserted } );
– Harry