File size: 3,203 Bytes
fc06b79 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace ContactManagementAPI.ViewModels
{
public class LoginViewModel
{
[Required]
[MaxLength(100)]
public string UserName { get; set; } = string.Empty;
[Required]
[DataType(DataType.Password)]
public string Password { get; set; } = string.Empty;
public string? ReturnUrl { get; set; }
}
public class UserCreateViewModel
{
[Required]
[MaxLength(100)]
public string UserName { get; set; } = string.Empty;
[Required]
[DataType(DataType.Password)]
public string Password { get; set; } = string.Empty;
[MaxLength(200)]
public string? FullName { get; set; }
[Required]
public int GroupId { get; set; }
public bool IsAdmin { get; set; }
public bool IsActive { get; set; } = true;
}
public class UserEditViewModel
{
public int Id { get; set; }
[Required]
[MaxLength(100)]
public string UserName { get; set; } = string.Empty;
[MaxLength(200)]
public string? FullName { get; set; }
[DataType(DataType.Password)]
public string? NewPassword { get; set; }
[Required]
public int GroupId { get; set; }
public bool IsAdmin { get; set; }
public bool IsActive { get; set; } = true;
}
public class GroupEditViewModel
{
public int Id { get; set; }
[Required]
[MaxLength(150)]
public string Name { get; set; } = string.Empty;
[MaxLength(500)]
public string? Description { get; set; }
}
public class RightAssignmentViewModel
{
public string Key { get; set; } = string.Empty;
public string Category { get; set; } = string.Empty;
public string Label { get; set; } = string.Empty;
public bool IsGranted { get; set; }
public string Selection { get; set; } = "Inherit";
public bool EffectiveGranted { get; set; }
public string EffectiveSource { get; set; } = "";
}
public class GroupRightsViewModel
{
public int GroupId { get; set; }
public string GroupName { get; set; } = string.Empty;
public List<RightAssignmentViewModel> Rights { get; set; } = new();
}
public class UserRightsViewModel
{
public int UserId { get; set; }
public string UserName { get; set; } = string.Empty;
public string? GroupName { get; set; }
public List<RightAssignmentViewModel> Rights { get; set; } = new();
}
public class AdminHistoryEntryViewModel
{
public string ActionType { get; set; } = string.Empty;
public string EntityType { get; set; } = string.Empty;
public int? EntityId { get; set; }
public string Details { get; set; } = string.Empty;
public string PerformedBy { get; set; } = string.Empty;
public DateTime PerformedAt { get; set; }
}
public class AdminHistoryListViewModel
{
public List<AdminHistoryEntryViewModel> Entries { get; set; } = new();
}
}
|