void SaveProperties() { Role = new UserRole(); Role.UID = UID; Role.Name = Name; Role.PermissionStrings = new List<string>( Permissions.Where(x => x.IsEnable).Select(x => x.Name) ); }
public RoleDetailsViewModel(UserRole role = null) { if (role != null) { Title = string.Format("Свойства роли: {0}", role.Name); Role = role; } else { Title = "Создание новой роли"; Role = new UserRole(); } CopyProperties(); }
void CopyProperties() { Login = User.Login; Name = User.Name; Roles = new ObservableCollection<UserRole>(); foreach (var role in FiresecManager.SecurityConfiguration.UserRoles) Roles.Add(role); if (IsNew) { UserRole = Roles.FirstOrDefault(); } else { UserRole = Roles.FirstOrDefault(role => role.Id == User.RoleId); } RemoteAccess = (IsNew || User.RemoreAccess == null) ? new RemoteAccessViewModel(new RemoteAccess() { RemoteAccessType = RemoteAccessType.RemoteAccessBanned }) : new RemoteAccessViewModel(User.RemoreAccess); }