public IHttpActionResult Puttb_pagarprestamo(int id, tb_prestamos tb_prestamo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } tb_prestamos tb_prestamos = db.tb_prestamos.Find(id); if (tb_prestamos == null) { return(NotFound()); } tb_prestamos.estado = tb_prestamo.estado; db.Entry(tb_prestamos).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tb_prestamosExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Gettb_prestamos(int id) { tb_prestamos tb_prestamos = db.tb_prestamos.Find(id); if (tb_prestamos == null) { return(NotFound()); } return(Ok(tb_prestamos)); }
public IHttpActionResult Posttb_prestamos(tb_prestamos tb_prestamos) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tb_prestamos.Add(tb_prestamos); db.SaveChanges(); return(Ok(tb_prestamos)); }
public IHttpActionResult Deletetb_prestamos(int id) { tb_prestamos tb_prestamos = db.tb_prestamos.Find(id); if (tb_prestamos == null) { return(NotFound()); } db.tb_prestamos.Remove(tb_prestamos); db.SaveChanges(); return(Ok(tb_prestamos)); }