public IHttpActionResult PostMA_CXP(MA_CXP mA_CXP) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.MA_CXP.Add(mA_CXP); try { db.SaveChanges(); } catch (DbUpdateException) { if (MA_CXPExists(mA_CXP.C_Documento)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = mA_CXP.C_Documento }, mA_CXP)); }
public IHttpActionResult PutMA_CXP(string id, MA_CXP mA_CXP) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != mA_CXP.C_Documento) { return(BadRequest()); } db.Entry(mA_CXP).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!MA_CXPExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetMA_CXP(string id) { MA_CXP mA_CXP = db.MA_CXP.Find(id); if (mA_CXP == null) { return(NotFound()); } return(Ok(mA_CXP)); }
public IHttpActionResult DeleteMA_CXP(string id) { MA_CXP mA_CXP = db.MA_CXP.Find(id); if (mA_CXP == null) { return(NotFound()); } db.MA_CXP.Remove(mA_CXP); db.SaveChanges(); return(Ok(mA_CXP)); }