public static Task <IHttpResponse> CreateAsync(
            [Property(Name = Resources.ProcessStageType.IdPropertyName)] Guid processStageTypeId,
            [Property(Name = Resources.ProcessStageType.OwnerPropertyName)] Guid ownerId,
            [Property(Name = Resources.ProcessStageType.GroupPropertyName)] Guid processStageGroupId,
            [Property(Name = Resources.ProcessStageType.TitlePropertyName)] string title,
            [Property(Name = Resources.ProcessStageType.ResourceTypePropertyName)] Type resourceType,
            [Property(Name = Resources.ProcessStageType.ResourceKeysPropertyName)] string[] resourceKeys,
            [Property(Name = Resources.ProcessStageType.ResourceTypesPropertyName)] Type[] resourceTypes,
            EastFive.Api.Security security, IHttpRequest request, IProvideUrl url,
            CreatedResponse onCreated,
            CreatedBodyResponse <ProcessStageType> onCreatedAndModified,
            AlreadyExistsResponse onAlreadyExists,
            AlreadyExistsReferencedResponse onRelationshipAlreadyExists,
            ReferencedDocumentNotFoundResponse onReferenceNotFound,
            UnauthorizedResponse onUnauthorized,
            GeneralConflictResponse onFailure)
        {
            var resourceList = resourceKeys.Zip(resourceTypes, (k, v) => k.PairWithValue(v)).ToArray();

            return(ProcessStageTypes.CreateAsync(processStageTypeId, ownerId, processStageGroupId, title,
                                                 resourceType, resourceList,
                                                 security,
                                                 () => onCreated(),
                                                 () => onAlreadyExists(),
                                                 () => onReferenceNotFound(),
                                                 (brokenId) => onReferenceNotFound(),
                                                 (why) => onFailure(why)));
        }
        public static async Task <IHttpResponse> FindByIdAsync(
            [QueryParameter(CheckFileName = true)] Guid processStageTypeId,
            EastFive.Api.Security security,
            ContentResponse onFound,
            NotFoundResponse onNotFound,
            UnauthorizedResponse onUnauthorized)
        {
            return(await await ProcessStageTypes.FindAllAsync(security,
                                                              types =>
                                                              types.First(
                                                                  async(stage, next) =>
            {
                if (stage.processStageTypeId == processStageTypeId)
                {
                    return onFound(stage);
                }
                return await next();
            },
                                                                  () => onNotFound().ToTask()),
                                                              () => onUnauthorized().ToTask()));

            //return Connectors.FindByIdAsync(id,
            //        security.performingAsActorId, security.claims,
            //    (synchronization, destinationIntegrationId) => onFound(GetResource(synchronization, destinationIntegrationId, url)),
            //    () => onNotFound(),
            //    () => onUnauthorized());
        }
 public static Task <IHttpResponse> FindAllAsync(
     EastFive.Api.Security security, IProvideUrl url,
     MultipartAcceptArrayResponse onMultipart,
     UnauthorizedResponse onUnauthorized)
 {
     return(ProcessStageTypes.FindAllAsync(security,
                                           types => onMultipart(types.Select(type => GetResource(type, url))),
                                           () => onUnauthorized()));
 }
示例#4
0
 public static async Task <HttpResponseMessage> FindAllAsync(
     EastFive.Api.Security security, HttpRequestMessage request, UrlHelper url,
     MultipartAcceptArrayResponseAsync onMultipart,
     UnauthorizedResponse onUnauthorized)
 {
     return(await await ProcessStageTypes.FindAllAsync(security,
                                                       types => onMultipart(types.Select(type => GetResource(type, url))),
                                                       () => onUnauthorized().ToTask()));
 }