public IHttpActionResult PutHotel(int id, Hotel hotel) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != hotel.Hotel_No) { return BadRequest(); } db.Entry(hotel).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!HotelExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostHotel(Hotel hotel) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Hotels.Add(hotel); try { db.SaveChanges(); } catch (DbUpdateException) { if (HotelExists(hotel.Hotel_No)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = hotel.Hotel_No }, hotel); }
public Hotel Details() { Hotel h = new Hotel(); DataSetHotelTableAdapters.hotelTableAdapter hotel = new HotelWebService.DataSetHotelTableAdapters.hotelTableAdapter(); h.BankAccountNumber1 = (int)hotel.getBankAccountNumber(); h.ContactNumber1 = (int)hotel.getContactNumber(); h.Description1 = (string)hotel.getDescription(); h.HotelName1 = (string)hotel.getHotelName(); h.Email1 = (string)hotel.getEmail(); h.Location1 = (string)hotel.getLocation(); return h; }