public EquipmentViewModel Post([FromBody] EquipmentViewModel equipmentViewModel) { EquipmentDTO equipmentDTO = configsGenerator.ViewModelToEquipmentDTO().Map <EquipmentDTO>(equipmentViewModel); equipmentDTO.IncludedRooms = configsGenerator.ViewModelToRoomDTO().Map <List <RoomDTO> >(equipmentViewModel.RoomsThatHaveIt); EquipmentDTO CreatedEquipmentDTO = EquipmentBLRepository.Create(equipmentDTO); EquipmentViewModel CreatedEquipmentViewModel = configsGenerator.DTOToEquipmentViewModel().Map <EquipmentViewModel>(CreatedEquipmentDTO); CreatedEquipmentViewModel.RoomsThatHaveIt = configsGenerator.DTOToRoomViewModel().Map <List <RoomViewModel> >(CreatedEquipmentDTO.IncludedRooms); return(CreatedEquipmentViewModel); }
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); }