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