예제 #1
0
        // GET: api/Page?name=pagename&grouping=groupname
        public async Task <PageRequest> Get(string name, string grouping)
        {
            var returnResult = new PageRequest();

            var processor = GetAzureProcessor();

            var pageData = await processor.CreateTable("Page");

            returnResult.Page = await processor.RetrieveFromTable <PageEntity>("Page", grouping, name);

            returnResult.FontsMetadata = GetFonts(returnResult.Page.Fonts);

            using (var PostsCtrl = new PostsController())
            {
                var postGroup = grouping + "|" + name;
                returnResult.Posts = PostsCtrl.Get(postGroup.ToLower());
            }

            if (!string.IsNullOrEmpty(returnResult.Page.BannerPicture))
            {
                using (var ctrlFileStorage = new FileStorageController())
                {
                    returnResult.BannerPhoto = await ctrlFileStorage.Get(returnResult.Page.BannerPicture);
                }
            }

            using (var BannersCtrl = new BannersController()) {
                var bannerGroup = grouping + "|" + name;
                returnResult.Banners = BannersCtrl.Get(bannerGroup);
            }



            return(returnResult);
        }
예제 #2
0
        // GET: api/Post?name=postname&grouping=groupname
        public async Task <PostRequest> Get(string name, string grouping)
        {
            var returnResult = new PostRequest();

            var processor = GetAzureProcessor();

            var postData = await processor.CreateTable("Post");

            returnResult.Post = await processor.RetrieveFromTable <PostEntity>("Post", grouping, name);

            returnResult.FontsMetadata = GetFonts(returnResult.Post.Fonts);

            if (!string.IsNullOrEmpty(returnResult.Post.BannerPicture))
            {
                using (var ctrlFileStorage = new FileStorageController())
                {
                    returnResult.BannerPhoto = await ctrlFileStorage.Get(returnResult.Post.BannerPicture);
                }
            }

            return(returnResult);
        }