public static RestUser UserToRest(User usr, bool usePassword) { if (usr == null) return null; RestUser restUser = new RestUser() { UserID = usr.ID, Description = usr.Description, FullName = usr.FullName, SecurityLevel = usr.SecurityLevel }; if (usePassword) { if (usr.Password != null) { restUser.Password = usr.Password.ToList(); } restUser.PasswordChanged = usr.PasswordChanged; restUser.NewPassword = usr.NewPassword; } if (usr is DefaultAdminUser) { restUser.IsDefaultAdmin = true; } foreach (FingerPrint fp in usr.FingerPrints) { List<byte> print = null; if (fp.Print != null) { print = fp.Print.ToList(); } restUser.FingerPrints.Add(new RestFingerPrint() { PrintNumber = fp.PrintNumber, Print = print }); } return restUser; }
public static RestUser UserToRest(User usr) { return UserToRest(usr, true); }