123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using AutoMapper;
- using Microsoft.AspNetCore.Identity;
- using MTWorkHR.Application.Models;
- using MTWorkHR.Core.Global;
- using MTWorkHR.Identity.Entities;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace MTWorkHR.Application.Mapper
- {
- public class MappingProfile : Profile
- {
- public MappingProfile() {
-
- CreateMap<UserDto, ApplicationUser>()
- .ForMember(m => m.UserRoles, op => op.Ignore())
- .ForMember(m => m.Id, op => op.Ignore());
- CreateMap<ApplicationUser, UserDto>();
- CreateMap<ApplicationUser, UserAllDto>()
- .ForMember(s => s.ManagerName, o => o.MapFrom(s => s.Manager.FirstName)
-
-
- );
- CreateMap<UserUpdateDto, ApplicationUser>()
- .ForMember(m => m.UserRoles, op => op.Ignore())
-
-
-
- .ForMember(m => m.Id, op => op.Ignore());
- CreateMap<ApplicationUser, UserUpdateDto>();
- CreateMap<AttachmentDto, UserAttachment>().ReverseMap();
- CreateMap<UserAddress, UserAddressDto>().ReverseMap();
-
- CreateMap<IdentityUserRole<string>, UserRoleDto>().ReverseMap();
- CreateMap<ApplicationRole, UserRoleDto>()
- .ForMember(m => m.RoleId, op => op.MapFrom(mp => mp.Id))
- .ForMember(m => m.RoleName, op => op.MapFrom(mp => mp.Name))
- .ReverseMap();
-
- CreateMap<RoleDto, ApplicationRole>()
- .ForMember(m => m.Id, op => op.Ignore())
- .ForMember(m => m.RolePermissions, op => op.Ignore())
- ;
- CreateMap<ApplicationRole, RoleDto>();
- CreateMap<RolePermissionDto, RolePermission>().ReverseMap();
-
- }
- }
- }
|