示例#1
0
        public void Clear()
        {
            SuitableParentUserGroups.Clear();
            SuitableParentUserGroups.Add(new UserGroupDto {
                Id = Guid.Empty, Name = "None"
            });
            SelectedParentUserGroup = SuitableParentUserGroups[0];

            originalId             = Id = null;
            originalName           = Name = null;
            originalSelectedParent = SelectedParentUserGroup;
        }
示例#2
0
        public void Populate(IEnumerable <UserGroupDto> suitableParentUserGroups, UserGroupDto currentUserGroup = null)
        {
            foreach (var suitableParentUserGroup in suitableParentUserGroups)
            {
                SuitableParentUserGroups.Add(suitableParentUserGroup);
            }

            if (currentUserGroup != null)
            {
                originalName           = Name = currentUserGroup.Name;
                originalId             = Id = currentUserGroup.Id;
                originalSelectedParent = SelectedParentUserGroup;

                if (currentUserGroup.ParentId.HasValue)
                {
                    originalSelectedParent = SelectedParentUserGroup = SuitableParentUserGroups.First(u => u.Id == currentUserGroup.ParentId);
                }
            }
        }