public IHttpActionResult PutEventoTDB(long id, EventoTDB eventoTDB) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != eventoTDB.idEvento) { return(BadRequest()); } db.Entry(eventoTDB).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EventoTDBExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetEventoTDB(long id) { EventoTDB eventoTDB = db.EventoTDB.Find(id); if (eventoTDB == null) { return(NotFound()); } return(Ok(eventoTDB)); }
public IHttpActionResult PostEventoTDB(EventoTDB eventoTDB) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.EventoTDB.Add(eventoTDB); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = eventoTDB.idEvento }, eventoTDB)); }
public IHttpActionResult DeleteEventoTDB(long id) { EventoTDB eventoTDB = db.EventoTDB.Find(id); if (eventoTDB == null) { return(NotFound()); } db.EventoTDB.Remove(eventoTDB); db.SaveChanges(); return(Ok(eventoTDB)); }