protected override async Task Apply(SamsaraConfigServiceModel source, SamsaraConfig target)
 {
     if (source == null)
     {
         return;
     }
     // Do Additional saving things here
 }
Пример #2
0
 public static SamsaraConfigServiceModel MapSamsaraConfig(this IMapperService mapper, SamsaraConfig model, SamsaraConfigServiceModel serviceModel = null)
 {
     serviceModel = serviceModel ?? new SamsaraConfigServiceModel();
     mapper.MapTo <SamsaraConfig, SamsaraConfigServiceModel>(model, serviceModel);
     return(serviceModel);
 }
Пример #3
0
        public virtual async Task <SamsaraConfigServiceModel> Handle(SaveSamsaraConfigRequest request, CancellationToken cancellationToken)
        {
            SamsaraConfig target = null;

            if (string.IsNullOrEmpty(request.ServiceModel.Id))
            {
                // new
                target = new SamsaraConfig();
            }
            else
            {
                target = await Repo.Find(request.ServiceModel.Id);
            }

            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.ApiKey = source.ApiKey;



            target.GroupId = source.GroupId;



            target.EmailDomain = source.EmailDomain;



            target.SyncDrivers = source.SyncDrivers;



            target.PayrollType = source.PayrollType;



            target.PayrollRate = source.PayrollRate;



            target.InvoiceItemCategoryId = source.InvoiceItemCategoryId;


            await Apply(request.ServiceModel, target);

            // Save it
            await Repo.Save(target);

            return(this.Mapper.MapTo <SamsaraConfig, SamsaraConfigServiceModel>(target));
        }
Пример #4
0
 protected virtual async Task Apply(SamsaraConfigServiceModel source, SamsaraConfig target)
 {
 }
Пример #5
0
 public override void MapMore(SamsaraConfig source, SamsaraConfigServiceModel target)
 {
     // Additional Mappings ...
 }