/// <summary> /// Get a Collection of all Rooms from one Hotel /// </summary> /// <param name="p_hotel">Hotelobject with an ID set</param> /// <returns>Collection of Rooms.</returns> public ICollection <Room> GetCollectionByHotel(DomainModel.Hotel p_hotel) { using (var context = new FhdwHotelContext()) { return(context.Room.Where(r => r.Hotel.ID == p_hotel.ID).ToList()); } }
/// <summary> /// Get a Collection of all Rooms in a Hotel. /// </summary> /// <param name="p_hotel">Hotelobject with at least the ID of the Hotel.</param> /// <returns>Filled, or empty Collection.</returns> public HttpResponseMessage Get([FromUri(Name = "Hotel")] DomainModel.Hotel p_hotel) { try { return(Request.CreateResponse(HttpStatusCode.OK, _roomService.GetCollectionByHotel(p_hotel))); } catch (Exception ex) { return(HandleGeneralError(ex)); } }
/// <summary> /// Get a Collection of Rooms wich are possesed by a Hotel. /// </summary> /// <returns>Filled or empty Collection</returns> public ICollection <Room> GetCollectionByHotel(DomainModel.Hotel p_hotel) { return(_roomRepository.GetCollectionByHotel(p_hotel)); }