public IHttpActionResult PostHUESPED(HUESPED hUESPED) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.HUESPEDs.Add(hUESPED); try { db.SaveChanges(); } catch (DbUpdateException) { if (HUESPEDExists(hUESPED.HUESPED_RUT)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = hUESPED.HUESPED_RUT }, hUESPED)); }
public IHttpActionResult PutHUESPED(decimal id, HUESPED hUESPED) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != hUESPED.HUESPED_RUT) { return(BadRequest()); } db.Entry(hUESPED).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!HUESPEDExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetHUESPED(decimal id) { HUESPED hUESPED = db.HUESPEDs.Find(id); if (hUESPED == null) { return(NotFound()); } return(Ok(hUESPED)); }
public IHttpActionResult DeleteHUESPED(decimal id) { HUESPED hUESPED = db.HUESPEDs.Find(id); if (hUESPED == null) { return(NotFound()); } db.HUESPEDs.Remove(hUESPED); db.SaveChanges(); return(Ok(hUESPED)); }