| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- namespace ToyStoreApp;
- public sealed record AppUser(int UserId, string FullName, string RoleName)
- {
- public bool IsAdmin => RoleName.Contains("администратор", StringComparison.CurrentCultureIgnoreCase);
- public bool IsManager => RoleName.Contains("менеджер", StringComparison.CurrentCultureIgnoreCase);
- public bool IsClient => RoleName.Contains("клиент", StringComparison.CurrentCultureIgnoreCase);
- public bool CanSearch => IsAdmin || IsManager;
- public bool CanEditProducts => IsAdmin;
- public bool CanEditOrders => IsAdmin;
- public bool CanViewOrders => IsAdmin || IsManager;
- }
- public sealed class ProductView
- {
- public int ProductId { get; set; }
- public string Article { get; set; } = "";
- public string Name { get; set; } = "";
- public string Category { get; set; } = "";
- public string Description { get; set; } = "";
- public string Manufacturer { get; set; } = "";
- public string Supplier { get; set; } = "";
- public decimal Price { get; set; }
- public decimal DiscountPercent { get; set; }
- public decimal FinalPrice => Math.Round(Price * (100 - DiscountPercent) / 100, 2);
- public string Unit { get; set; } = "";
- public int StockQuantity { get; set; }
- public string ImagePath { get; set; } = "picture.png";
- }
- public sealed class OrderView
- {
- public int OrderId { get; set; }
- public string Customer { get; set; } = "";
- public string PickupPoint { get; set; } = "";
- public string Status { get; set; } = "";
- public DateTime? OrderDate { get; set; }
- public DateTime? DeliveryDate { get; set; }
- public string ReceiveCode { get; set; } = "";
- public string Articles { get; set; } = "";
- }
|