Add project data
This commit is contained in:
57
Tabletop.Core/Models/Permission.cs
Normal file
57
Tabletop.Core/Models/Permission.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using DbController;
|
||||
using Tabletop.Core.Interfaces;
|
||||
using Tabletop.Core.Models.Abstract;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Permission : LocalizationModelBase<PermissionDescription>
|
||||
{
|
||||
[CompareField("permission_id")]
|
||||
public int PermissionId { get; set; }
|
||||
|
||||
[CompareField("identifier")]
|
||||
public string Identifier { get; set; } = string.Empty;
|
||||
|
||||
public int? GetIdentifier()
|
||||
{
|
||||
return PermissionId > 0 ? PermissionId : null;
|
||||
}
|
||||
|
||||
public IEnumerable<Dictionary<string, object?>> GetLocalizedParameters()
|
||||
{
|
||||
foreach (var description in Description)
|
||||
{
|
||||
yield return new Dictionary<string, object?>
|
||||
{
|
||||
{ "PERMISSION_ID", PermissionId },
|
||||
{ "NAME", description.Name },
|
||||
{ "DESCRIPTION", description.Description }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "PERMISSION_ID", PermissionId },
|
||||
{ "IDENTIFIER", Identifier }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class PermissionDescription : ILocalizationHelper
|
||||
{
|
||||
[CompareField("permission_id")]
|
||||
public int PermissionId { get; set; }
|
||||
|
||||
[CompareField("code")]
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("description")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user