/// <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) { this.TotalCapacity = model.TotalCapacity; this.UsedCapacity = model.UsedCapacity; this.UsedCapacityPercent = model.UsedCapacityPercent; this.CapacityConstraint = FormatHelper.CapacityConstraintBitsToString(model.CapacityConstraintBits); this.CapacityConstraintBits = model.CapacityConstraintBits; }
/// <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) { // Calculated properties. this.AcceptingNewBuilds = !model.TagsMetas.Any(x => x.Tag.Name == "no new builds"); this.CapacityConstraint = FormatHelper.CapacityConstraintBitsToString(model.CapacityConstraintBits); this.CapacityConstraintBits = model.CapacityConstraintBits; // IHasCapacity members. this.TotalCapacity = model.TotalCapacity; this.UsedCapacity = model.UsedCapacity; // Per Justin - anything over 100% just display as 100%. this.UsedCapacityPercent = Math.Min(1, model.UsedCapacityPercent); }