protected override async Task Apply(EdiConfigServiceModel source, EdiConfig target) { if (source == null) { return; } // Do Additional saving things here }
public virtual async Task <EdiConfigServiceModel> Handle(SaveEdiConfigRequest request, CancellationToken cancellationToken) { EdiConfig target = null; target = await FindExisting(request.ServiceModel) ?? new EdiConfig(); if (target == null) { throw new Exception("Could not save the shipment with that id. It was not found."); } var source = request.ServiceModel; target.Id = source.Id; target.Enabled = source.Enabled; target.Username = source.Username; target.Password = source.Password; target.RsaKey = source.RsaKey; target.CompanyId = source.CompanyId; await Apply(request.ServiceModel, target); // Save it await Repo.Save(target); return(this.Mapper?.MapTo <EdiConfig, EdiConfigServiceModel>(target)); }
public override void MapMore(EdiConfig source, EdiConfigServiceModel target) { // Additional Mappings ... }
public static EdiConfigServiceModel MapEdiConfig(this IMapperService mapper, EdiConfig model, EdiConfigServiceModel serviceModel = null, int fidelity = 1) { serviceModel = serviceModel ?? new EdiConfigServiceModel(); mapper.MapTo <EdiConfig, EdiConfigServiceModel>(model, serviceModel, fidelity); return(serviceModel); }
protected virtual async Task Apply(EdiConfigServiceModel source, EdiConfig target) { }
public virtual async Task OnMap(EdiConfig model, EdiConfigServiceModel serviceModel) { }