namespace MyOffice.Web.Models.Account; using AutoMapper; using MyOffice.Services.Account.Domain; using MyOffice.Services.Identity; using Newtonsoft.Json; using System.ComponentModel.DataAnnotations; public class AccountViewModel: IResponseModel { public string? Id { get; set; } [Required] public string Name { get; set; } = null!; public string Type { get; set; } = null!; [Required] public string CurrencyId { get; set; } = null!; public string? CurrencyName { get; set; } public List? Categories { get; set; } [Required] public string CategoryId { get; set; } = null!; #region Permissions public List? AccessRights { get; set; } public bool AllowRead { get; set; } public bool AllowWrite { get; set; } public bool AllowDelete { get; set; } public bool AllowManage { get; set; } #endregion Permissions } public class AccountViewModelProfile : Profile { public AccountViewModelProfile() { CreateMap() .ForMember(x => x.CurrencyId, o => o.MapFrom(x => x.CurrencyGlobalId)) .ForMember(x => x.CurrencyName, o => o.MapFrom(x => x.Currency!.Name)) .AfterMap() ; } } public class AccountViewModelMappingAction : IMappingAction { private readonly IContextProvider _contextProvider; public AccountViewModelMappingAction(IContextProvider contextProvider) { _contextProvider = contextProvider; } public void Process(AccountDto source, AccountViewModel destination, ResolutionContext context) { } }