Ejemplo n.º 1
0
 public static Task <IHttpResponse> UpdateAsync(
     [WorkflowParameter(Value = "{{TeamsNotification}}")]
     [UpdateId] IRef <TeamsNotification> teamsNotificationRef,
     [MutateResource] MutateResource <TeamsNotification> updated,
     ContentTypeResponse <TeamsNotification> onUpdated,
     NotFoundResponse onNotFound,
     UnauthorizedResponse onUnauthorized)
 {
     return(teamsNotificationRef
            .HttpPatchAsync(updated,
                            onUpdated,
                            onNotFound));
 }
Ejemplo n.º 2
0
        public static Task <IHttpResponse> HttpPatchAsync <TResource>(
            this IRef <TResource> resourceRef,
            MutateResource <TResource> modifyResource,
            ContentTypeResponse <TResource> onUpdated,
            NotFoundResponse onNotFound,
            Func <TResource, TResource> additionalMutations = default)
            where TResource : IReferenceable
        {
            return(resourceRef.StorageUpdateAsync(
                       async(resource, saveAsync) =>
            {
                var resourceToSave = modifyResource(resource);
                if (additionalMutations.IsNotDefaultOrNull())
                {
                    resourceToSave = additionalMutations(resourceToSave);
                }

                await saveAsync(resource);
                return onUpdated(resource);
            },
                       () => onNotFound()));
        }