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

62 lines
2.1 KiB
C#
Raw Normal View History

using ModelTools.Attributes;
using ModelTools.ViewModels;
using System;
namespace SecurityBusinessLogic.ViewModels
{
/// <summary>
/// Список пользователей
/// </summary>
public class UserListViewModel : ListViewModel<UserViewModel> { }
/// <summary>
/// Элемент пользователей
/// </summary>
public class UserViewModel : ElementViewModel
{
[ViewModelProperty("Пользователь", true, true)]
[MapConfiguration("UserName")]
public string Login { get; set; }
[ViewModelProperty("Студент", false, true)]
[MapConfiguration("StudentId")]
public Guid? StudentId { get; set; }
[ViewModelProperty("Преподаватель", false, true)]
[MapConfiguration("LecturerId")]
public Guid? LecturerId { get; set; }
[ViewModelProperty("Сотрудник", false, true)]
[MapConfiguration("EmployeeId")]
public Guid? EmployeeId { get; set; }
[ViewModelProperty("Фото", false, true)]
[MapConfiguration("Avatar")]
public byte[] Avatar { get; set; }
[ViewModelProperty("Посл. визит", true, false, 100)]
[MapConfiguration("DateLastVisit")]
public DateTime? DateLastVisit { get; set; }
[ViewModelProperty("Блокировка", false, true)]
[MapConfiguration("IsBanned")]
public bool IsBanned { get; set; }
[ViewModelProperty("Блокир.", true, false, 100)]
public string Banned => IsBanned ? "Да" : "Нет";
[ViewModelProperty("Дата Б.", false, true, 100)]
[MapConfiguration("DateBanned")]
public DateTime? DateBanned { get; set; }
[ViewModelProperty("Дата Б.", true, false, 100)]
public string DateBannedTitle => DateBanned.HasValue ? DateBanned.Value.ToShortDateString() : string.Empty;
[ViewModelProperty("Количество попыток входа", false, false)]
[MapConfiguration("CountAttempt")]
public int CountAttempt { get; set; }
public override string ToString() => Login;
}
}