Beispiel #1
0
        public GetRoomTypeResponseDto GetRoomTypeByProperty(int propertyId)
        {
            if (propertyId <= 0)
            {
                throw new PmsException("Property id is not valid.");
            }

            var response = new GetRoomTypeResponseDto();

            if (!AppConfigReaderHelper.AppConfigToBool(AppSettingKeys.MockEnabled))
            {
                response.RoomTypes = _iPmsLogic.GetRoomTypeByProperty(propertyId);
            }
            else
            {
                //mock data
                response.RoomTypes = new List <Resources.Entities.RoomType>
                {
                    new PmsEntity.RoomType
                    {
                        Id   = 1,
                        Name = "King-Smoking",
                    },
                    new PmsEntity.RoomType
                    {
                        Id   = 2,
                        Name = "King-NonSmoking"
                    },
                    new PmsEntity.RoomType
                    {
                        Id   = 3,
                        Name = "Queen-Smoking"
                    },
                    new PmsEntity.RoomType
                    {
                        Id   = 4,
                        Name = "Test King-Smoking"
                    }
                };
            }
            return(response);
        }
Beispiel #2
0
        public GetRoomTypeResponseDto GetRoomTypeById(int propertyId, int typeId)
        {
            if (propertyId <= 0)
            {
                throw new PmsException("Property id is not valid.");
            }

            var response = new GetRoomTypeResponseDto();

            if (typeId <= 0)
            {
                return(response);
            }
            var roomTypeResponseDto = GetRoomTypeByProperty(propertyId);

            if (roomTypeResponseDto == null || roomTypeResponseDto.RoomTypes == null || roomTypeResponseDto.RoomTypes.Count <= 0)
            {
                return(response);
            }

            response.RoomTypes = roomTypeResponseDto.RoomTypes.Where(x => x.Id.Equals(typeId)).ToList();
            return(response);
        }