DepartmentProject/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs

43 lines
1.2 KiB
C#
Raw Normal View History

using ModelTools.Attributes;
using ModelTools.Enums;
using ModelTools.ViewModels;
using System;
namespace SecurityBusinessLogic.ViewModels
{
/// <summary>
/// Список достпуов
/// </summary>
public class AccessListViewModel : ListViewModel<AccessViewModel> { }
/// <summary>
/// Элемент доступа
/// </summary>
public class AccessViewModel : ElementViewModel
{
[ViewModelProperty("Роль", false, true)]
[MapConfiguration("RoleId")]
public Guid RoleId { get; set; }
[ViewModelProperty("Роль", true, false, 100)]
[MapConfiguration("Role.RoleName", true)]
public string RoleName { get; set; }
[ViewModelProperty("Операция", false, true)]
[MapConfiguration("AccessOperation")]
public AccessOperation AccessOperation { get; set; }
[ViewModelProperty("Операция", true, false)]
public string AccessOperationTitle => AccessOperation.ToString("G");
[ViewModelProperty("Тип", false, true)]
[MapConfiguration("AccessType")]
public AccessType AccessType { get; set; }
[ViewModelProperty("Тип", true, false, 50)]
public string AccessTypeTitle => AccessType.ToString("G");
public override string ToString() => $"{RoleName}-{AccessOperationTitle}({AccessTypeTitle})";
}
}