Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static async Task <IsoImage> GetAsync(long id)
        {
            string responseContent = await ApiCore.SendRequest(string.Format("/isos/{0}", id.ToString()));

            Objects.Isos.Get.Iso response = JsonConvert.DeserializeObject <Objects.Isos.Get.Iso>(responseContent);

            IsoImage isoImage = GetIsoImageFromResponseData(response);

            return(isoImage);
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="isoImage"></param>
        /// <returns></returns>
        private static IsoImage GetIsoImageFromResponseData(Objects.Isos.Get.Iso isoImage)
        {
            IsoImage image = new IsoImage();

            image.Id          = isoImage.id;
            image.Name        = isoImage.name;
            image.Type        = isoImage.type;
            image.Description = isoImage.description;

            if (!string.IsNullOrEmpty(isoImage.deprecated) &&
                !string.IsNullOrWhiteSpace(isoImage.deprecated))
            {
                image.Deprecated = DateTime.Parse(isoImage.deprecated);
            }

            return(image);
        }