public ActivityViewModel Post([FromBody] ActivityViewModel viewModel) { ActivityDTO activityDTO = configsGenerator.ViewModelToActivityDTO().Map <ActivityDTO>(viewModel); activityDTO.IncludedRooms = configsGenerator.ViewModelToRoomDTO().Map <List <RoomDTO> >(viewModel.PosibleRooms); ActivityDTO CreatedActivityDTO = ActivitiesBLRepository.Create(activityDTO); ActivityViewModel activityViewModel = configsGenerator.DTOToActivityViewModel().Map <ActivityViewModel>(CreatedActivityDTO); activityViewModel.PosibleRooms = configsGenerator.DTOToRoomViewModel().Map <List <RoomViewModel> >(CreatedActivityDTO.IncludedRooms); return(activityViewModel); }
public RoomViewModel Post([FromBody] RoomViewModel roomViewModel) { RoomDTO roomDTO = configsGenerator.ViewModelToRoomDTO().Map <RoomDTO>(roomViewModel); roomDTO.IncludedActivities = configsGenerator.ViewModelToActivityDTO().Map <List <ActivityDTO> >(roomViewModel.PosibleActivities); roomDTO.IncludedEquipment = configsGenerator.ViewModelToEquipmentDTO().Map <List <EquipmentDTO> >(roomViewModel.RoomEquipment); roomDTO.IncludedOrders = configsGenerator.ViewModelToOrderDTO().Map <List <OrderDTO> >(roomViewModel.RoomOrders); RoomDTO CreatedRoomDTO = RoomsBLRepository.Create(roomDTO); RoomViewModel CreatedRoomViewModel = configsGenerator.DTOToRoomViewModel().Map <RoomViewModel>(CreatedRoomDTO); CreatedRoomViewModel.PosibleActivities = configsGenerator.DTOToActivityViewModel().Map <List <ActivityViewModel> >(CreatedRoomDTO.IncludedActivities); CreatedRoomViewModel.RoomEquipment = configsGenerator.DTOToEquipmentViewModel().Map <List <EquipmentViewModel> >(CreatedRoomDTO.IncludedEquipment); CreatedRoomViewModel.RoomOrders = configsGenerator.DTOToOrderViewModel().Map <List <OrderViewModel> >(CreatedRoomDTO.IncludedOrders); return(CreatedRoomViewModel); }