protected override async Task Apply(EdiMessageLogServiceModel source, EdiMessageLog target) { if (source == null) { return; } // Do Additional saving things here }
public virtual async Task <EdiMessageLogServiceModel> Handle(SaveEdiMessageLogRequest request, CancellationToken cancellationToken) { EdiMessageLog target = null; target = await FindExisting(request.ServiceModel) ?? new EdiMessageLog(); 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.ReferenceId = source.ReferenceId; target.Type = source.Type; target.Status = source.Status; target.EdiTypeNumber = source.EdiTypeNumber; target.MessageTypeName = source.MessageTypeName; target.TradingChannelId = source.TradingChannelId; target.TradingPartnerId = source.TradingPartnerId; target.Content = source.Content; target.ErrorMessage = source.ErrorMessage; await Apply(request.ServiceModel, target); // Save it await Repo.Save(target); return(this.Mapper?.MapTo <EdiMessageLog, EdiMessageLogServiceModel>(target)); }
public virtual async Task OnMap(EdiMessageLog model, EdiMessageLogServiceModel serviceModel) { }
public static EdiMessageLogServiceModel MapEdiMessageLog(this IMapperService mapper, EdiMessageLog model, EdiMessageLogServiceModel serviceModel = null, int fidelity = 1) { serviceModel = serviceModel ?? new EdiMessageLogServiceModel(); mapper.MapTo <EdiMessageLog, EdiMessageLogServiceModel>(model, serviceModel, fidelity); return(serviceModel); }
protected virtual async Task Apply(EdiMessageLogServiceModel source, EdiMessageLog target) { }
public override void MapMore(EdiMessageLog source, EdiMessageLogServiceModel target) { // Additional Mappings ... }