コード例 #1
0
        public async Task <GetLandingPageResult> HandleAsync(GetLandingPageQuery query)
        {
            query.AssertNotNull("query");

            var queryResult = await this.getLandingPageDbStatement.ExecuteAsync(query.CreatorUsername);

            if (queryResult == null)
            {
                return(null);
            }

            var blog     = queryResult.Blog;
            var channels = queryResult.Channels;

            FileInformation headerFileInformation = null;

            if (blog.HeaderImageFileId != null)
            {
                headerFileInformation = await this.fileInformationAggregator.GetFileInformationAsync(
                    null,
                    blog.HeaderImageFileId,
                    FilePurposes.ProfileHeaderImage);
            }

            FileInformation profileImageFileInformation = null;

            if (queryResult.ProfileImageFileId != null)
            {
                profileImageFileInformation = await this.fileInformationAggregator.GetFileInformationAsync(
                    null,
                    queryResult.ProfileImageFileId,
                    FilePurposes.ProfileImage);
            }

            var blogWithFileInformation = new BlogWithFileInformation(
                blog.BlogId,
                blog.BlogName,
                blog.Introduction,
                blog.CreationDate,
                headerFileInformation,
                blog.Video,
                blog.Description,
                channels,
                blog.Queues);

            return(new GetLandingPageResult(
                       queryResult.UserId,
                       profileImageFileInformation,
                       blogWithFileInformation));
        }
コード例 #2
0
        public UserState(
            Fifthweek.Api.FileManagement.Queries.UserAccessSignatures accessSignatures,
            Fifthweek.Api.Identity.Membership.GetAccountSettingsResult accountSettings,
            Fifthweek.Api.Blogs.Queries.BlogWithFileInformation blog,
            Fifthweek.Api.Blogs.Queries.GetUserSubscriptionsResult subscriptions)
        {
            if (accessSignatures == null)
            {
                throw new ArgumentNullException("accessSignatures");
            }

            this.AccessSignatures = accessSignatures;
            this.AccountSettings  = accountSettings;
            this.Blog             = blog;
            this.Subscriptions    = subscriptions;
        }