43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using System.ComponentModel.DataAnnotations.Schema;
|
|
using FoodsharingSiegen.Contracts.Helper;
|
|
|
|
namespace FoodsharingSiegen.Contracts.Entity
|
|
{
|
|
|
|
/// <summary>
|
|
/// The user class (a. beging, 06.04.2022)
|
|
/// </summary>
|
|
public partial class User
|
|
{
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// Gets or sets the value of the groups list (ab)
|
|
/// </summary>
|
|
[NotMapped]
|
|
public List<UserGroup> GroupsList
|
|
{
|
|
get
|
|
{
|
|
if (string.IsNullOrWhiteSpace(Groups)) return new List<UserGroup>();
|
|
var stringList = Groups.Split(",");
|
|
var enumList = stringList.Where(x => !string.IsNullOrWhiteSpace(x)).Select(Enum.Parse<UserGroup>).ToList();
|
|
return enumList;
|
|
}
|
|
set => Groups = string.Join(",", value);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets or sets the value of the password (ab)
|
|
/// </summary>
|
|
[NotMapped]
|
|
public string Password
|
|
{
|
|
get => Cryptor.TryDecrypt(EncryptedPassword, out var password) ? password : string.Empty;
|
|
set => EncryptedPassword = Cryptor.Encrypt(value);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|