public static async Task <AddressObject> Run(AddressObject entity) { var client = Connection.Get; switch (entity.EventAction) { case Models.Enums.Action.Add: entity.AddResponse = await client.AddClientAddressAsync( new AddClientAddressRequest() { RID = entity.RID, MessageGuid = Guid.NewGuid(), Address = entity.Value, PropBag = Helpers.Settings.PropBag }); break; case Models.Enums.Action.Update: if (entity.Value.ID.HasValue) { entity.UpdateResponse = await client.UpdateClientAddressAsync( new UpdateClientAddressRequest() { RID = entity.RID, MessageGuid = Guid.NewGuid(), NewAddress = entity.Value, AddressIDToUpdate = entity.Value.ID.Value, AddressUsageEnumToUpdate = entity.Value.AddressUsages[0].AddressUsageEnum, NewAddressUsageEnum = entity.Value.AddressUsages[0].AddressUsageEnum, PropBag = Helpers.Settings.PropBag }); } break; case Models.Enums.Action.Remove: if (entity.Value.ID.HasValue) { entity.RemoveResponse = await client.RemoveClientAddressAsync(new RemoveClientAddressRequest() { RID = entity.RID, MessageGuid = Guid.NewGuid(), AddressID = entity.Value.ID.Value, PropBag = "<PROPBAG></PROPBAG>" }); } break; } return(entity); }
public static async Task<AddressObject> UpdateAddress(AddressObject entity) { return await LG.Data.Core.Clients.Details.Address.Run(entity); }
public static async Task<AddressObject> Run(AddressObject entity) { var client = Connection.Get; switch (entity.EventAction) { case Models.Enums.Action.Add: entity.AddResponse = await client.AddClientAddressAsync( new AddClientAddressRequest() { RID = entity.RID, MessageGuid = Guid.NewGuid(), Address = entity.Value, PropBag = Helpers.Settings.PropBag }); break; case Models.Enums.Action.Update: if (entity.Value.ID.HasValue) entity.UpdateResponse = await client.UpdateClientAddressAsync( new UpdateClientAddressRequest() { RID = entity.RID, MessageGuid = Guid.NewGuid(), NewAddress = entity.Value, AddressIDToUpdate = entity.Value.ID.Value, AddressUsageEnumToUpdate = entity.Value.AddressUsages[0].AddressUsageEnum, NewAddressUsageEnum = entity.Value.AddressUsages[0].AddressUsageEnum, PropBag = Helpers.Settings.PropBag }); break; case Models.Enums.Action.Remove: if (entity.Value.ID.HasValue) entity.RemoveResponse = await client.RemoveClientAddressAsync(new RemoveClientAddressRequest() { RID = entity.RID, MessageGuid = Guid.NewGuid(), AddressID = entity.Value.ID.Value, PropBag = "<PROPBAG></PROPBAG>" }); break; } return entity; }