0% found this document useful (0 votes)
11 views2 pages

Metodo para Serializacion en Java

The document describes API endpoints for user login and registration, as well as getting and updating client data from a database. It includes code to connect to a SQL database and query for client records.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Metodo para Serializacion en Java

The document describes API endpoints for user login and registration, as well as getting and updating client data from a database. It includes code to connect to a SQL database and query for client records.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Login

get
post

Registro Usuario

Post

Registro Clientes

Post

private readonly VerificaCreditoContext _context;

public ClientesController(VerificaCreditoContext context)


{
_context = context;
}

public async Task<ActionResult<Clientes>> Get(string Nombre_Cliente)

{
SqlConnection con = new SqlConnection("Data Source=LAPTOP-TEJ9IAPK;user
id=EmanuelT; password=Qwerty123; Initial Catalog=VerificaCredito; Integrated
Security=true; Trusted_Connection=SSPI");
SqlCommand cmd = new SqlCommand("SELECT * FROM Clientes");
var clientes = await _context.Clientes.FindAsync(Nombre_Cliente);

if (clientes == null)
{
return NotFound();
}

// return clientes;
}

// PUT: api/Clientes1/5
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?
linkid=2123754
[HttpPut("{id}")]
public async Task<IActionResult> PutClientes(int id, Clientes clientes)
{
if (id != clientes.Id)
{
return BadRequest();
}

_context.Entry(clientes).State = EntityState.Modified;

try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!ClientesExists(id))
{
return NotFound();
}
else
{
throw;
}
}

return NoContent();
}

You might also like