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

55 lines
1.6 KiB
C#

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