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); }
public List <OrderViewModel> Get(bool WithRooms) { List <OrderDTO> orderDTOs; if (WithRooms) { orderDTOs = OrdersBLRepository.GetWithEverything(); } else { orderDTOs = OrdersBLRepository.Get(); } List <OrderViewModel> orderViewModels = configsGenerator.DTOToOrderViewModel().Map <List <OrderViewModel> >(orderDTOs); for (int i = 0; i < orderViewModels.Count; i++) { orderViewModels[i].OrderedRooms = configsGenerator.DTOToRoomViewModel().Map <List <RoomViewModel> >(orderDTOs[i].IncludedRooms); } return(orderViewModels); }