using AutoMapper; using Microsoft.AspNetCore.Identity; using MTWorkHR.Application.Models; using MTWorkHR.Core.Global; using MTWorkHR.Identity.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MTWorkHR.Application.MappingProfiles { public class MappingProfile : Profile { public MappingProfile() { //identity user CreateMap() .ForMember(m => m.UserRoles, op => op.Ignore()) .ForMember(m => m.Id, op => op.Ignore()); CreateMap(); CreateMap() .ForMember(s => s.ManagerName, o => o.MapFrom(s => s.Manager.FirstName) //.ForMember(s => s.DepartmentName, o => o.MapFrom(s => GlobalInfo.lang == "ar" ? s.Department.NameAr : s.Department.NameEn) ); CreateMap() .ForMember(m => m.UserRoles, op => op.Ignore()) // .ForMember(m => m.UserBranchs, op => op.Ignore()) // .ForMember(m => m.UserCycleApprovals, op => op.Ignore()) //.ForMember(m => m.Hierarchies, op => op.Ignore()) .ForMember(m => m.Id, op => op.Ignore()); CreateMap(); //identity userRoles CreateMap, UserRoleDto>().ReverseMap(); CreateMap() .ForMember(m => m.RoleId, op => op.MapFrom(mp => mp.Id)) .ForMember(m => m.RoleName, op => op.MapFrom(mp => mp.Name)) .ReverseMap(); //identity role CreateMap() .ForMember(m => m.Id, op => op.Ignore()) .ForMember(m => m.RolePermissions, op => op.Ignore()) ; CreateMap(); CreateMap().ReverseMap(); } } }