29 lines
721 B
C#
29 lines
721 B
C#
namespace OpenArchival.Blazor.AdminPages.Shared;
|
|
|
|
using OpenArchival.DataAccess;
|
|
|
|
public class UserDto
|
|
{
|
|
public string Id { get; set; } = "";
|
|
public string? Username { get; set; }
|
|
public IEnumerable<string> Roles { get; set; } = new HashSet<string>();
|
|
public string? Password { get; set; }
|
|
public string RolesDisplay { get => string.Join(",", Roles); }
|
|
|
|
public static ApplicationUser ToApplicationUser(UserDto user)
|
|
{
|
|
var newUser = new ApplicationUser
|
|
{
|
|
UserName = user.Username,
|
|
Email = user.Username
|
|
};
|
|
|
|
if (!string.IsNullOrEmpty(user.Id))
|
|
{
|
|
newUser.Id = user.Id;
|
|
}
|
|
|
|
return newUser;
|
|
}
|
|
|
|
} |