Пример #1
0
        public List <RoomInfo> getAllRoomInfos()
        {
            try
            {
                var         hotelFacade = new HotelFacade();
                List <Room> rooms       = hotelFacade.getAllRooms();
                if (rooms != null && rooms.Count > 0)
                {
                    List <RoomInfo> roomInfos = new List <RoomInfo>();

                    foreach (Room room in rooms)
                    {
                        RoomInfo roomInfo = new RoomInfo();
                        roomInfo.roomNo      = room.RoomNo;
                        roomInfo.roomType    = room.RoomType.Name;
                        roomInfo.dailyCharge = room.RoomType.DailyCharge.ToString();
                        roomInfo.capacity    = room.RoomType.Capacity;
                        roomInfos.Add(roomInfo);
                    }

                    return(roomInfos);
                }
                else
                {
                    throw new Exception("No room Available");
                }
            }
            catch (Exception e)
            {
                throw new FaultException <Exception>(e);
            }
        }