public IHttpActionResult PostMA_COMPRAS(MA_COMPRAS mA_COMPRAS) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.MA_COMPRAS.Add(mA_COMPRAS); try { db.SaveChanges(); } catch (DbUpdateException) { if (MA_COMPRASExists(mA_COMPRAS.c_DOCUMENTO)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = mA_COMPRAS.c_DOCUMENTO }, mA_COMPRAS)); }
public IHttpActionResult PutMA_COMPRAS(string id, MA_COMPRAS mA_COMPRAS) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != mA_COMPRAS.c_DOCUMENTO) { return(BadRequest()); } db.Entry(mA_COMPRAS).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!MA_COMPRASExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetMA_COMPRAS(string id) { MA_COMPRAS mA_COMPRAS = db.MA_COMPRAS.Find(id); if (mA_COMPRAS == null) { return(NotFound()); } return(Ok(mA_COMPRAS)); }
public IHttpActionResult DeleteMA_COMPRAS(string id) { MA_COMPRAS mA_COMPRAS = db.MA_COMPRAS.Find(id); if (mA_COMPRAS == null) { return(NotFound()); } db.MA_COMPRAS.Remove(mA_COMPRAS); db.SaveChanges(); return(Ok(mA_COMPRAS)); }