This commit is contained in:
2023-07-29 16:25:16 +03:00
parent 90f0386bfe
commit 4312a5c084
34 changed files with 1998 additions and 61 deletions
@@ -1,29 +1,16 @@
namespace MyOffice.Web.Models.Account
namespace MyOffice.Web.Models.Account;
using MyOffice.Core.Attributes;
using MyOffice.Services.Account.Domain;
using System.ComponentModel.DataAnnotations;
[Link(typeof(AccountCategoryDto))]
public class AccountCategoryViewModel
{
using System.ComponentModel.DataAnnotations;
using Core.Extensions;
using Data.Models.Accounts;
public string? Id { get; set; }
public class AccountCategoryViewModel
{
public string? Id { get; set; }
[Required]
public string? Name { 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(),
};
}
}
}
public bool? AllowDelete { get; set; }
}