// POST odata/DadoSatelite public IHttpActionResult Post(DadoSatelite dadosatelite) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.DadoSatelites.Add(dadosatelite); try { db.SaveChanges(); } catch (DbUpdateException) { if (DadoSateliteExists(dadosatelite.idDadoSatelite)) { return(Conflict()); } else { throw; } } return(Created(dadosatelite)); }
// PUT odata/DadoSatelite(5) public IHttpActionResult Put([FromODataUri] int key, DadoSatelite dadosatelite) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (key != dadosatelite.idDadoSatelite) { return(BadRequest()); } db.Entry(dadosatelite).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DadoSateliteExists(key)) { return(NotFound()); } else { throw; } } return(Updated(dadosatelite)); }
public IHttpActionResult Patch([FromODataUri] int key, Delta <DadoSatelite> patch) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } DadoSatelite dadosatelite = db.DadoSatelites.Find(key); if (dadosatelite == null) { return(NotFound()); } patch.Patch(dadosatelite); try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DadoSateliteExists(key)) { return(NotFound()); } else { throw; } } return(Updated(dadosatelite)); }
// DELETE odata/DadoSatelite(5) public IHttpActionResult Delete([FromODataUri] int key) { DadoSatelite dadosatelite = db.DadoSatelites.Find(key); if (dadosatelite == null) { return(NotFound()); } db.DadoSatelites.Remove(dadosatelite); db.SaveChanges(); return(StatusCode(HttpStatusCode.NoContent)); }