Exemplo n.º 1
0
 internal static object FromDto(MachineDto20182 dto)
 {
     return(new Machine
     {
         Id = dto.Id,
         LicenseKey = dto.LicenseKey,
         Name = dto.Name,
         NonProductionSlots = dto.NonProductionSlots,
         UnattendedSlots = dto.UnattendedSlots
     });
 }
        private void AddMachine20182()
        {
            var machine = new MachineDto20182
            {
                Name = Name,
                NonProductionSlots = NonProductionSlots,
                UnattendedSlots    = UnattendedSlots,
            };

            if (MyInvocation.BoundParameters.ContainsKey(nameof(LicenseKey)))
            {
                machine.LicenseKey = LicenseKey.ToString();
            }
            var response = HandleHttpOperationException(() => Api_18_2.Machines.Post(machine));

            WriteObject(Machine.FromDto(response));
        }