示例#1
0
        public static BlockInfoDto MockRecipeDetail()
        {
            BlockInfoDto block = new BlockInfoDto();

            block.Name       = "RecipeDetail";
            block.WidgetName = BlockRegister.RecipeBlock.WidgetName;
            block.IsBuiltIn  = true;

            List <SubitemInfoDto> items = new List <SubitemInfoDto>();

            block.Subitems = items;
            GridDto ingredientGrid = new GridDto()
            {
                Id = CmsRegister.IngredientGridId
            };
            GridDto instructionGrid = new GridDto()
            {
                Id = CmsRegister.InstructionGridId
            };

            items.Add(new SubitemInfoDto {
                SubitemId = BlockRegister.RecipeBlock.IngredientGrid, Grid = ingredientGrid
            });
            items.Add(new SubitemInfoDto {
                SubitemId = BlockRegister.RecipeBlock.InstructionGrid, Grid = instructionGrid
            });

            return(block);
        }
示例#2
0
 public BlockInfoDto GetBlock(object blockId)
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CMSDataStoreKey))
     {
         BlockFacade  facade = new BlockFacade(uow);
         BlockInfoDto result = facade.GetBlockInfo(blockId, new BlockInfoConverter());
         return(result);
     }
 }
示例#3
0
        public static BlockInfoDto MockHeroImage()
        {
            BlockInfoDto block = new BlockInfoDto();

            block.Name       = "Hero Image";
            block.WidgetName = BlockRegister.HeroImageBlock.WidgetName;
            block.IsBuiltIn  = true;

            return(block);
        }
示例#4
0
        public static BlockInfoDto MockCardViewWidget()
        {
            BlockInfoDto block = new BlockInfoDto();

            block.Name       = "CardViewWidget";
            block.WidgetName = BlockRegister.CardViewWidget.WidgetName;
            block.IsBuiltIn  = true;

            return(block);
        }
示例#5
0
        public static BlockInfoDto MockFeaturedContent2nd()
        {
            BlockInfoDto block = new BlockInfoDto();

            block.Name       = "FeaturedContent2";
            block.WidgetName = BlockRegister.FeaturedContent2nd.WidgetName;
            block.IsBuiltIn  = true;

            return(block);
        }
示例#6
0
        public static BlockInfoDto MockRotator()
        {
            BlockInfoDto block = new BlockInfoDto();

            block.Name       = "Rotator";
            block.WidgetName = BlockRegister.Rotator.WidgetName;
            block.IsBuiltIn  = true;

            return(block);
        }
示例#7
0
        public static BlockInfoDto MockYouTubeVideo()
        {
            BlockInfoDto block = new BlockInfoDto();

            block.Name       = "YouTubeVideo";
            block.WidgetName = BlockRegister.YouTubeVideoBlock.WidgetName;
            block.IsBuiltIn  = true;

            return(block);
        }
示例#8
0
        public static BlockInfoDto MockBlogDetail()
        {
            BlockInfoDto block = new BlockInfoDto();

            block.Name       = "BlogDetail";
            block.WidgetName = BlockRegister.BlogDetail.WidgetName;
            block.IsBuiltIn  = true;

            return(block);
        }
        public void TestAll()
        {
            BlockFacade         facade = new BlockFacade(UnitOfWork);
            List <BlockInfoDto> result = facade.GetBlocksInfo <BlockInfoDto>(new BlockInfoConverter());

            if (result != null)
            {
            }

            BlockInfoDto item = facade.GetBlockInfo <BlockInfoDto>(7, new BlockInfoConverter());
        }
        public Result <BlockInfoDto> GetBlockInfo(long blockNumber)
        {
            using (var uow = NewUnitOfWork())
            {
                var block = NewRepository <Block>(uow)
                            .Get(b => b.BlockNumber == blockNumber, b => b.Validator)
                            .SingleOrDefault();

                if (block is null)
                {
                    return(Result.Failure <BlockInfoDto>("Block {0} does not exist.".F(blockNumber)));
                }

                return(Result.Success(BlockInfoDto.FromDomainModel(block)));
            }
        }
示例#11
0
        public static BlockInfoDto MockAdWidget()
        {
            BlockInfoDto block = new BlockInfoDto();

            block.Name       = "AdWidget";
            block.WidgetName = "AdWidget";
            block.IsBuiltIn  = true;

            List <SubitemInfoDto> items = new List <SubitemInfoDto>();

            block.Subitems = items;
            items.Add(new SubitemInfoDto {
                SubitemId = BlockRegister.AdWidget.AdType, DefaultValue = "1"
            });

            return(block);
        }
示例#12
0
        public static BlockInfoDto MockRelatedContent()
        {
            BlockInfoDto block = new BlockInfoDto();

            block.Name       = "RelatedContent";
            block.WidgetName = BlockRegister.RelatedContent.WidgetName;
            block.IsBuiltIn  = true;

            List <SubitemInfoDto> items = new List <SubitemInfoDto>();

            block.Subitems = items;
            items.Add(new SubitemInfoDto {
                SubitemId = BlockRegister.RelatedContent.Title, DefaultValue = "Similar Content"
            });

            return(block);
        }
示例#13
0
        public static BlockInfoDto MockPhotoGallery()
        {
            BlockInfoDto block = new BlockInfoDto();

            block.Name       = "PhotoGallery";
            block.WidgetName = BlockRegister.PhotoGallery.WidgetName;
            block.IsBuiltIn  = true;

            List <SubitemInfoDto> items = new List <SubitemInfoDto>();

            block.Subitems = items;
            GridDto photosGrid = new GridDto()
            {
                Id = CmsRegister.PhotosGridId
            };

            items.Add(new SubitemInfoDto {
                SubitemId = BlockRegister.PhotoGallery.PhotosGrid, Grid = photosGrid
            });

            return(block);
        }