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 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 OrderViewModel Post([FromBody] OrderViewModel orderViewModel) { OrderDTO orderDTO = configsGenerator.ViewModelToOrderDTO().Map <OrderDTO>(orderViewModel); orderDTO.IncludedRooms = configsGenerator.ViewModelToRoomDTO().Map <List <RoomDTO> >(orderViewModel.OrderedRooms); if (!orderService.HasIntersection(orderDTO.StartDate, orderDTO.Hours, orderDTO.IncludedRooms)) { OrderDTO CreatedOrderDTO = OrdersBLRepository.Create(orderDTO); OrderViewModel ReturnedOrderViewModel = configsGenerator.DTOToOrderViewModel().Map <OrderViewModel>(CreatedOrderDTO); ReturnedOrderViewModel.OrderedRooms = configsGenerator.DTOToRoomViewModel().Map <List <RoomViewModel> >(CreatedOrderDTO.IncludedRooms); return(ReturnedOrderViewModel); } return(null); }
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); }