Database updates
This commit is contained in:
@@ -1,23 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using FoodsharingSiegen.Shared.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 => AuthHelper.Decrypt(EncryptedPassword);
|
||||
get => AuthHelper.TryDecrypt(EncryptedPassword, out var password) ? password : string.Empty;
|
||||
set => EncryptedPassword = AuthHelper.Encrypt(value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user