public async Task <IHttpActionResult> Postdetallereservacion(detallereservacion detallereservacion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.detallereservacion.Add(detallereservacion); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (detallereservacionExists(detallereservacion.idreservacion)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = detallereservacion.idreservacion }, detallereservacion)); }
public async Task <IHttpActionResult> Putdetallereservacion(int id, detallereservacion detallereservacion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != detallereservacion.idreservacion) { return(BadRequest()); } db.Entry(detallereservacion).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!detallereservacionExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> Getdetallereservacion(int id) { detallereservacion detallereservacion = await db.detallereservacion.FindAsync(id); if (detallereservacion == null) { return(NotFound()); } return(Ok(detallereservacion)); }
public async Task <IHttpActionResult> Deletedetallereservacion(int id) { detallereservacion detallereservacion = await db.detallereservacion.FindAsync(id); if (detallereservacion == null) { return(NotFound()); } db.detallereservacion.Remove(detallereservacion); await db.SaveChangesAsync(); return(Ok(detallereservacion)); }