fix
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
namespace MyOffice.Services.Account.Domain;
|
||||
/// <see cref="MyOffice.Data.Models.Accounts.AccountCategory"/>
|
||||
namespace MyOffice.Services.Account.Domain;
|
||||
|
||||
using AutoMapper;
|
||||
using MyOffice.Data.Models.Accounts;
|
||||
|
||||
public class AccountCategoryDto
|
||||
{
|
||||
@@ -6,4 +10,15 @@ public class AccountCategoryDto
|
||||
public Guid UserId { get; set; }
|
||||
public string Name { get; set; } = null!;
|
||||
public bool AllowDelete { get; set; }
|
||||
}
|
||||
|
||||
public class AccountCategoryDtoProfile: Profile
|
||||
{
|
||||
public AccountCategoryDtoProfile()
|
||||
{
|
||||
CreateMap<AccountCategory, AccountCategoryDto>()
|
||||
.ForMember(x => x.Id, o => o.MapFrom(x => x.Id))
|
||||
.ForMember(x => x.AllowDelete, o => o.MapFrom(x => !x.Accounts!.Any()))
|
||||
;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user