private ICartItemViewModel CustomJewelCartItemViewModelBuilderMethod(ICartItem cartItem, int index)
        {
            try
            {
                var customJewel = cartItem as CustomJewelCartItem;
                jewelRepository.FilterMediaByMetal(customJewel.MediaType);
                var diamond = diamondRepository.GetDiamondByID(customJewel.DiamondID);
                var jewel   = jewelRepository.GetJewelByID(customJewel.SettingID);

                var twoObjects = new MergeDiamondAndJewel()
                {
                    First  = diamond,
                    Second = jewel
                };


                var viewModel = mapper.Map <MergeDiamondAndJewel, CustomJewelCartItemViewModel>(twoObjects);
                viewModel.CartID = index;
                viewModel.Size   = customJewel.GetSize();
                return(viewModel);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message +
                                    "\n When asked to build a view model for jewelcartitem we had a problem explained above");
            }
        }
Ejemplo n.º 2
0
        public EndViewModel Build()
        {
            var mapperHelp = new MergeDiamondAndJewel();

            mapperHelp.First = diamondRepository.GetDiamondByID(customJewelPersistenceInEndPage.DiamondID);

            jewelRepository.FilterMediaByMetal(customJewelPersistenceInEndPage.MediaType);
            mapperHelp.Second = jewelRepository.GetJewelByID(customJewelPersistenceInEndPage.SettingID);

            var viewModel = mapper.Map<MergeDiamondAndJewel,EndViewModel >(mapperHelp);

            viewModel.TabsForJewelDesignNavigation = tabsForJewelDesignBuilder.Build();

            viewModel.JewelPersistence = new CustomJewelPersistenceBase()
                                             {
                                                 DiamondID = customJewelPersistenceInEndPage.DiamondID,
                                                 SettingID = customJewelPersistenceInEndPage.SettingID,
                                                 Size = customJewelPersistenceInEndPage.Size,
                                                 MediaType = customJewelPersistenceInEndPage.MediaType
                                             };

            return viewModel;
        }
Ejemplo n.º 3
0
        public EndViewModel Build()
        {
            var mapperHelp = new MergeDiamondAndJewel();

            mapperHelp.First = diamondRepository.GetDiamondByID(customJewelPersistenceInEndPage.DiamondID);

            jewelRepository.FilterMediaByMetal(customJewelPersistenceInEndPage.MediaType);
            mapperHelp.Second = jewelRepository.GetJewelByID(customJewelPersistenceInEndPage.SettingID);

            var viewModel = mapper.Map <MergeDiamondAndJewel, EndViewModel>(mapperHelp);

            viewModel.TabsForJewelDesignNavigation = tabsForJewelDesignBuilder.Build();

            viewModel.JewelPersistence = new CustomJewelPersistenceBase()
            {
                DiamondID = customJewelPersistenceInEndPage.DiamondID,
                SettingID = customJewelPersistenceInEndPage.SettingID,
                Size      = customJewelPersistenceInEndPage.Size,
                MediaType = customJewelPersistenceInEndPage.MediaType
            };


            return(viewModel);
        }
        private ICartItemViewModel CustomJewelCartItemViewModelBuilderMethod(ICartItem cartItem, int index)
        {
            try
            {
                var customJewel = cartItem as CustomJewelCartItem;
                jewelRepository.FilterMediaByMetal(customJewel.MediaType);
                var diamond = diamondRepository.GetDiamondByID(customJewel.DiamondID);
                var jewel = jewelRepository.GetJewelByID(customJewel.SettingID);

                var twoObjects = new MergeDiamondAndJewel()
                                     {
                                         First = diamond,
                                         Second = jewel
                                     };

                var viewModel = mapper.Map<MergeDiamondAndJewel, CustomJewelCartItemViewModel>(twoObjects);
                viewModel.CartID = index;
                viewModel.Size = customJewel.GetSize();
                return viewModel;
            }
            catch (Exception ex)
            {

                throw new Exception(ex.Message +
                                    "\n When asked to build a view model for jewelcartitem we had a problem explained above");
            }
        }