public IHttpActionResult PostTR_VENTAS(TR_VENTAS tR_VENTAS) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TR_VENTAS.Add(tR_VENTAS); try { db.SaveChanges(); } catch (DbUpdateException) { if (TR_VENTASExists(tR_VENTAS.c_DOCUMENTO)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = tR_VENTAS.c_DOCUMENTO }, tR_VENTAS)); }
public IHttpActionResult PutTR_VENTAS(string id, TR_VENTAS tR_VENTAS) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tR_VENTAS.c_DOCUMENTO) { return(BadRequest()); } db.Entry(tR_VENTAS).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TR_VENTASExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetTR_VENTAS(string id) { TR_VENTAS tR_VENTAS = db.TR_VENTAS.Find(id); if (tR_VENTAS == null) { return(NotFound()); } return(Ok(tR_VENTAS)); }
public IHttpActionResult DeleteTR_VENTAS(string id) { TR_VENTAS tR_VENTAS = db.TR_VENTAS.Find(id); if (tR_VENTAS == null) { return(NotFound()); } db.TR_VENTAS.Remove(tR_VENTAS); db.SaveChanges(); return(Ok(tR_VENTAS)); }