public IHttpActionResult Puttb_estado(int id, tb_estado tb_estado) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tb_estado.id) { return(BadRequest()); } db.Entry(tb_estado).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tb_estadoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Gettb_estado(int id) { tb_estado tb_estado = db.tb_estado.Find(id); if (tb_estado == null) { return(NotFound()); } return(Ok(tb_estado)); }
public IHttpActionResult Posttb_estado(tb_estado tb_estado) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tb_estado.Add(tb_estado); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = tb_estado.id }, tb_estado)); }
public IHttpActionResult Deletetb_estado(int id) { tb_estado tb_estado = db.tb_estado.Find(id); if (tb_estado == null) { return(NotFound()); } db.tb_estado.Remove(tb_estado); db.SaveChanges(); return(Ok(tb_estado)); }