Added mapper
This commit is contained in:
		| @@ -0,0 +1,14 @@ | ||||
| using ApplicationLayer.Services.Applicants.Models; | ||||
| using AutoMapper; | ||||
| using Domains.ApplicantDomain; | ||||
|  | ||||
| namespace Infrastructure.Automapper.Profiles | ||||
| { | ||||
|     public class ApplicantProfile : Profile | ||||
|     { | ||||
|         public ApplicantProfile() | ||||
|         { | ||||
|             CreateMap<Applicant, ApplicantModel>(MemberList.Destination); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,20 @@ | ||||
| using ApplicationLayer.Services.AuthServices.Requests; | ||||
| using AutoMapper; | ||||
| using Domains.Users; | ||||
|  | ||||
| namespace Infrastructure.Automapper.Profiles | ||||
| { | ||||
|     public class UserProfile : Profile | ||||
|     { | ||||
|         public UserProfile() | ||||
|         { | ||||
|             CreateMap<RegisterApplicantRequest, User>(MemberList.Destination) | ||||
|                 .ForMember(u => u.Role, | ||||
|                     opts => opts.Ignore()); | ||||
|  | ||||
|             CreateMap<RegisterRequest, User>() | ||||
|                 .ForMember(u => u.Role, | ||||
|                     opts => opts.Ignore()); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,25 @@ | ||||
| using ApplicationLayer.Services.VisaApplications.Models; | ||||
| using ApplicationLayer.Services.VisaApplications.Requests; | ||||
| using AutoMapper; | ||||
| using Domains.VisaApplicationDomain; | ||||
|  | ||||
| namespace Infrastructure.Automapper.Profiles | ||||
| { | ||||
|     public class VisaApplicationProfile : Profile | ||||
|     { | ||||
|         public VisaApplicationProfile() | ||||
|         { | ||||
|             CreateMap<VisaApplication, VisaApplicationModelForApplicant>(MemberList.Destination); | ||||
|  | ||||
|             CreateMap<VisaApplication, VisaApplicationModelForAuthority>(MemberList.Destination) | ||||
|                 .ForMember(model => model.Applicant, | ||||
|                     opts => opts.Ignore()); | ||||
|  | ||||
|             CreateMap<VisaApplicationCreateRequest, VisaApplication>(MemberList.Destination) | ||||
|                 .ForMember(va => va.RequestDate, | ||||
|                 opts => opts.Ignore()) | ||||
|                 .ForMember(va => va.ApplicantId, | ||||
|                 opts => opts.Ignore()); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -1,4 +1,5 @@ | ||||
| using ApplicationLayer.InfrastructureServicesInterfaces; | ||||
| using System.Reflection; | ||||
| using ApplicationLayer.InfrastructureServicesInterfaces; | ||||
| using ApplicationLayer.Services.Applicants.NeededServices; | ||||
| using ApplicationLayer.Services.AuthServices.NeededServices; | ||||
| using ApplicationLayer.Services.VisaApplications.NeededServices; | ||||
| @@ -37,6 +38,8 @@ public static class DependencyInjection | ||||
|  | ||||
|         services.AddSingleton<IDateTimeProvider, DateTimeProvider>(); | ||||
|  | ||||
|         services.AddAutoMapper(Assembly.GetExecutingAssembly()); | ||||
|  | ||||
|         return services; | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user