public List <RoomViewModel> Get(bool WithActivities, bool WithEquipment, bool WithOrders)
        {
            List <RoomDTO> roomDTOs;

            if (WithActivities || WithEquipment || WithOrders)
            {
                roomDTOs = RoomsBLRepository.GetWithEverything();
            }
            else
            {
                roomDTOs = RoomsBLRepository.Get();
            }
            List <RoomViewModel> roomViewModels = configsGenerator.DTOToRoomViewModel().Map <List <RoomViewModel> >(roomDTOs);

            for (int i = 0; i < roomViewModels.Count; i++)
            {
                if (WithActivities)
                {
                    roomViewModels[i].PosibleActivities = configsGenerator.DTOToActivityViewModel().Map <List <ActivityViewModel> >(roomDTOs[i].IncludedActivities);
                }
                if (WithEquipment)
                {
                    roomViewModels[i].RoomEquipment = configsGenerator.DTOToEquipmentViewModel().Map <List <EquipmentViewModel> >(roomDTOs[i].IncludedEquipment);
                }
                if (WithOrders)
                {
                    roomViewModels[i].RoomOrders = configsGenerator.DTOToOrderViewModel().Map <List <OrderViewModel> >(roomDTOs[i].IncludedOrders);
                }
            }
            return(roomViewModels);
        }
示例#2
0
        public List <ActivityViewModel> Get(bool WithRooms, bool IncludeSpecial)
        {
            List <ActivityDTO> activities;

            if (WithRooms)
            {
                if (IncludeSpecial)
                {
                    activities = ActivitiesBLRepository.GetWithEverything();
                }
                else
                {
                    activities = ActivitiesBLRepository.GetWithEverything().Where(a => a.IsSpecialActivity == false).ToList();
                }
            }
            else
            {
                if (IncludeSpecial)
                {
                    activities = ActivitiesBLRepository.Get();
                }
                else
                {
                    activities = ActivitiesBLRepository.GetWithEverything().Where(a => a.IsSpecialActivity == false).ToList();
                }
            }
            List <ActivityViewModel> activityViewModels = configsGenerator.DTOToActivityViewModel().Map <List <ActivityViewModel> >(activities);

            for (int i = 0; i < activityViewModels.Count; i++)
            {
                activityViewModels[i].PosibleRooms = configsGenerator.DTOToRoomViewModel().Map <List <RoomViewModel> >(activities[i].IncludedRooms);
            }
            return(activityViewModels);
        }