Files
myoffice/MyOffice.Web/Models/Account/AccountCategoryViewModel.cs
T
2023-06-22 10:01:27 +03:00

30 lines
610 B
C#

namespace MyOffice.Web.Models.Account
{
using System.ComponentModel.DataAnnotations;
using Core.Extensions;
using Data.Models.Accounts;
public class AccountCategoryViewModel
{
public string? Id { get; set; }
[Required]
public string? Name { get; set; }
public bool? AllowDelete { get; set; }
}
public static class AccountCategoryViewModelExtensions
{
public static AccountCategoryViewModel ToModel(this AccountCategory input)
{
return new AccountCategoryViewModel
{
Id = input.Id.ToShort(),
Name = input.Name,
AllowDelete = !input.Accounts?.Any(),
};
}
}
}