public IHttpActionResult PostHist_OT_Master(Hist_OT_Master hist_OT_Master) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Hist_OT_Master.Add(hist_OT_Master); try { db.SaveChanges(); } catch (DbUpdateException) { if (Hist_OT_MasterExists(hist_OT_Master.Id_OTMaster)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = hist_OT_Master.Id_OTMaster }, hist_OT_Master); }
public IHttpActionResult PutHist_OT_Master(int id, Hist_OT_Master hist_OT_Master) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != hist_OT_Master.Id_OTMaster) { return BadRequest(); } db.Entry(hist_OT_Master).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Hist_OT_MasterExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }