/// <summary> /// Map an AppUser to the DataObject User for saving. /// </summary> /// <returns></returns> public User MapToUser() { var user = new User(); if (!Id.IsNull()) { user.Id = Id.ToGuid(); } user.Email = UserName; user.PasswordHash = PasswordHash; user.SecurityStamp = SecurityStamp; user.IsNew = IsNew; user.EmailConfirmed = EmailConfirmed; return user; }
/// <summary> /// Map an AppUser from the DataObject User. /// </summary> /// <param name="user"></param> /// <returns></returns> public static AppUser MapFromUser(User user) { if (user != null) { var appUser = new AppUser(); appUser.Id = user.Id.ToString(); appUser.UserName = user.Email; appUser.Email = user.Email; appUser.PasswordHash = user.PasswordHash; appUser.SecurityStamp = user.SecurityStamp; appUser.IsNew = user.IsNew; appUser.EmailConfirmed = user.EmailConfirmed; return appUser; } else { return null; } }