/// <summary>
        /// Populates properties on the view model from an instance of the
        /// DataStore class.
        /// </summary>
        /// <param name="model">The DataStore to reference.</param>
        private void ReadEntityProperties(DataStore model)
        {
            // Properties from the entity.
            this.Capacity  = model.Capacity;
            this.FreeSpace = model.FreeSpace;

            // Related entities.
            if (model.DataStoreCategory != null)
            {
                this.DataStoreCategory = new DataStoreCategoryReferenceViewModel(model.DataStoreCategory);
            }
            else
            {
                this.DataStoreCategory = null;
            }

            if (model.DataStoreGroup != null)
            {
                this.DataStoreGroup = new DataStoreGroupReferenceViewModel(model.DataStoreGroup);
            }
            else
            {
                this.DataStoreGroup = null;
            }

            // IStorageCapacity Members.
            this.TotalStorageCapacity       = model.TotalStorageCapacity;
            this.UsedStorageCapacity        = model.UsedStorageCapacity;
            this.UsedStorageCapacityPercent = model.UsedStorageCapacityPercent;

            // Notes and Tags.
            this.Notes = new NoteCollectionListViewModel(model.Notes);
            this.Tags  = new TagCollectionListViewModel(model.TagsMetas);
        }
        /// <summary>
        /// Populates properties on the view model from an instance of the
        /// HypervisorGroup class.
        /// </summary>
        /// <param name="model">The HypervisorGroup to reference.</param>
        private void ReadEntityProperties(HypervisorGroup model)
        {
            // Properties from the entity.
            this.Id                  = model.Id;
            this.Name                = model.Name;
            this.Inactive            = model.Inactive;
            this.UsedCapacityPercent = model.UsedCapacityPercent;
            this.TotalCapacity       = model.TotalCapacity;
            this.UsedCapacity        = model.UsedCapacity;

            // Notes and Tags.
            this.Notes = new NoteCollectionListViewModel(model.Notes);
            this.Tags  = new TagCollectionListViewModel(model.TagsMetas);
        }
        /// <summary>
        /// Populates properties on the view model from an instance of the
        /// Hypervisor class.
        /// </summary>
        /// <param name="model">The Hypervisor to reference.</param>
        private void ReadEntityProperties(Hypervisor model)
        {
            // Related entities.
            this.HypervisorType = model.HypervisorType;

            if (model.HypervisorGroup != null)
            {
                this.HypervisorGroup = new HypervisorGroupReferenceViewModel(model.HypervisorGroup);
            }
            else
            {
                this.HypervisorGroup = null;
            }

            // IHasCapacity Members.
            this.TotalCapacity       = model.TotalCapacity;
            this.UsedCapacity        = model.UsedCapacity;
            this.UsedCapacityPercent = model.UsedCapacityPercent;

            // Notes and Tags.
            this.Notes = new NoteCollectionListViewModel(model.Notes);
            this.Tags  = new TagCollectionListViewModel(model.TagsMetas);
        }
Esempio n. 4
0
 /// <summary>
 /// Populates properties on the view model from an instance of the
 /// HypervisorController class.
 /// </summary>
 /// <param name="model">The HypervisorController to reference.</param>
 private void ReadEntityProperties(HypervisorController model)
 {
     // Notes and Tags.
     this.Notes = new NoteCollectionListViewModel(model.Notes);
     this.Tags  = new TagCollectionListViewModel(model.TagsMetas);
 }