示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="responseData"></param>
        /// <returns></returns>
        private static ServerType GetServerTypeFromResponseData(Objects.ServerType.Universal.ServerType responseData)
        {
            ServerType serverType = new ServerType();

            serverType._isInitialized = true;
            serverType._id            = responseData.id;
            serverType.Name           = responseData.name;
            serverType.Description    = responseData.description;
            serverType.Cores          = responseData.cores;
            serverType.CpuType        = responseData.cpu_type;
            serverType.Disc           = responseData.disk;
            serverType.Memory         = responseData.memory;
            serverType.StorageType    = responseData.storage_type;

            serverType.Prices = new List <ServerTypePricingValue>();

            foreach (Objects.ServerType.Universal.Price serverTypePrice in responseData.prices)
            {
                ServerTypePricingValue stpv = ServerType.GetServerTypePricingValueFromResponseData(serverTypePrice);

                serverType.Prices.Add(stpv);
            }

            return(serverType);
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="serverTypePrice"></param>
        /// <returns></returns>
        public static ServerTypePricingValue GetServerTypePricingValueFromResponseData(Objects.ServerType.Universal.Price serverTypePrice)
        {
            ServerTypePricingValue stpv = new ServerTypePricingValue();

            stpv.Location    = serverTypePrice.location;
            stpv.PriceHourly = new PricingValue()
            {
                Net   = serverTypePrice.price_hourly.net,
                Gross = serverTypePrice.price_hourly.gross
            };
            stpv.PriceMontly = new PricingValue()
            {
                Net   = serverTypePrice.price_monthly.net,
                Gross = serverTypePrice.price_monthly.gross
            };
            return(stpv);
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="serverType"></param>
        /// <returns></returns>
        public static ServerTypePricing GetServerTypePricingFromResponseData(Objects.Pricing.Get.ServerType serverType)
        {
            ServerTypePricing stp = new ServerTypePricing();

            stp.Id     = serverType.id;
            stp.Name   = serverType.name;
            stp.Prices = new List <ServerTypePricingValue>();

            foreach (Objects.ServerType.Universal.Price serverTypePrice in serverType.prices)
            {
                ServerTypePricingValue stpv = ServerType.GetServerTypePricingValueFromResponseData(serverTypePrice);

                stp.Prices.Add(stpv);
            }

            return(stp);
        }