Beispiel #1
0
        protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            // Object Container: Use objectContainer.Get<T>() to retrieve objects from the scope
            var objectContainer = context.GetFromContext <IObjectContainer>(TwilioApiScope.ParentContainerPropertyTag);

            // Inputs
            var accountsid = AccountSid.Get(context);

            var account = await AccountWrappers.GetAccountAsync(objectContainer.Get <ITwilioRestClient>(), accountsid);

            // Outputs
            return((ctx) => {
                Account.Set(ctx, account);
            });
        }
Beispiel #2
0
        protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            // Object Container: Use objectContainer.Get<T>() to retrieve objects from the scope
            var objectContainer = context.GetFromContext <IObjectContainer>(TwilioApiScope.ParentContainerPropertyTag);

            // Inputs
            var accountsid   = AccountSid.Get(context);
            var friendlyname = FriendlyName.Get(context);
            var status       = Status.Get(context);
            var twilioStatus = status == AccountStatus.Active ? AccountResource.StatusEnum.Active :
                               status == AccountStatus.Closed ? AccountResource.StatusEnum.Closed :
                               status == AccountStatus.Suspended ? AccountResource.StatusEnum.Suspended :
                               null;

            var account = await AccountWrappers.UpdateAccountAsync(objectContainer.Get <ITwilioRestClient>(), accountsid,
                                                                   friendlyname, twilioStatus);

            // Outputs
            return((ctx) => {
                Account.Set(ctx, account);
            });
        }