Пример #1
0
        public NavigationViewModel GetStoreActiveNavigations()
        {
            var r = new NavigationViewModel();

            r.Navigations = NavigationRepository.GetStoreActiveNavigations(MyStore.Id);
            return(r);
        }
Пример #2
0
        public ProductsViewModel GetProductIndexPage(string search, string page)
        {
            var resultModel = new ProductsViewModel();

            resultModel.SCategories  = ProductCategoryRepository.GetProductCategoriesByStoreIdFromCache(MyStore.Id, StoreConstants.ProductType);
            resultModel.SStore       = MyStore;
            resultModel.SNavigations = NavigationRepository.GetStoreActiveNavigations(this.MyStore.Id);
            resultModel.SSettings    = this.GetStoreSettings();
            return(resultModel);
        }
Пример #3
0
        public PhotosViewModel GetPhotos(int page)
        {
            var resultModel = new PhotosViewModel();

            resultModel.SStore = this.MyStore;
            var m = FileManagerRepository.GetImagesByStoreId(MyStore.Id, page, 24);

            resultModel.SFileManagers = new PagedList <FileManager>(m.items, m.page - 1, m.pageSize, m.totalItemCount);
            resultModel.SNavigations  = NavigationRepository.GetStoreActiveNavigations(this.MyStore.Id);
            resultModel.SSettings     = this.GetStoreSettings();
            return(resultModel);
        }
Пример #4
0
        public ProductDetailViewModel GetProductDetailPage(string id)
        {
            var resultModel = new ProductDetailViewModel();
            int productId   = id.Split("-".ToCharArray()).Last().ToInt();

            resultModel.SProduct     = ProductRepository.GetProductsById(productId);
            resultModel.SStore       = MyStore;
            resultModel.SCategory    = ProductCategoryRepository.GetProductCategory(resultModel.Product.ProductCategoryId);
            resultModel.SCategories  = ProductCategoryRepository.GetProductCategoriesByStoreId(MyStore.Id, StoreConstants.ProductType);
            resultModel.SNavigations = NavigationRepository.GetStoreActiveNavigations(this.MyStore.Id);
            resultModel.SSettings    = this.GetStoreSettings();
            return(resultModel);
        }
Пример #5
0
        public SitemapResult GetNavigationSiteMap(Controller sitemapsController)
        {
            var sitemapItems = new List <SitemapItem>();
            var navigations  = NavigationRepository.GetStoreActiveNavigations(this.MyStore.Id);

            foreach (var navigation in navigations)
            {
                var siteMap = new SitemapItem(sitemapsController.Url.QualifiedAction(navigation.ActionName, navigation.ControllerName),
                                              changeFrequency: SitemapChangeFrequency.Monthly, priority: 1.0);
                sitemapItems.Add(siteMap);
            }

            return(new SitemapResult(sitemapItems));
        }
        public ProductCategoryViewModel GetProductCategory(string id, int page)
        {
            var resultModel = new ProductCategoryViewModel();
            int categoryId  = id.Split("-".ToCharArray()).Last().ToInt();

            resultModel.SCategories = ProductCategoryRepository.GetProductCategoriesByStoreId(MyStore.Id, StoreConstants.ProductType);
            resultModel.SStore      = MyStore;
            resultModel.SCategory   = ProductCategoryRepository.GetProductCategory(categoryId);
            var m = ProductRepository.GetProductsCategoryId(MyStore.Id, categoryId, StoreConstants.ProductType, true, page, 24);

            resultModel.SProducts    = new PagedList <Product>(m.items, m.page - 1, m.pageSize, m.totalItemCount);
            resultModel.SNavigations = NavigationRepository.GetStoreActiveNavigations(this.MyStore.Id);
            resultModel.SSettings    = this.GetStoreSettings();
            return(resultModel);
        }
Пример #7
0
        public ContentsViewModel GetContentIndexPage(int page, String contentType)
        {
            var resultModel = new ContentsViewModel();

            resultModel.SStore = MyStore;
            var m = ContentRepository.GetContentsCategoryId(MyStore.Id, null, contentType, true, page, 24);

            resultModel.SContents    = new PagedList <Content>(m.items, m.page - 1, m.pageSize, m.totalItemCount);
            resultModel.SCategories  = CategoryRepository.GetCategoriesByStoreId(MyStore.Id, contentType, true);
            resultModel.Type         = contentType;
            resultModel.SNavigations = NavigationRepository.GetStoreActiveNavigations(this.MyStore.Id);
            resultModel.SSettings    = this.GetStoreSettings();

            return(resultModel);
        }
Пример #8
0
        public CategoryViewModel GetCategory(string id, int page, String categoryType)
        {
            var returnModel = new CategoryViewModel();
            int categoryId  = id.Split("-".ToCharArray()).Last().ToInt();

            StorePagedList <Content> task2 = ContentRepository.GetContentsCategoryId(MyStore.Id, categoryId, categoryType, true, page, 600);


            returnModel.SCategories  = CategoryRepository.GetCategoriesByStoreId(MyStore.Id, categoryType, true);
            returnModel.SStore       = MyStore;
            returnModel.SCategory    = CategoryRepository.GetCategory(categoryId);
            returnModel.Type         = categoryType;
            returnModel.SNavigations = NavigationRepository.GetStoreActiveNavigations(this.MyStore.Id);
            returnModel.SContents    = new PagedList <Content>(task2.items, task2.page - 1, task2.pageSize, task2.totalItemCount);


            return(returnModel);
        }
Пример #9
0
        public ContentDetailViewModel GetContentDetail(string id, string contentType)
        {
            var resultModel = new ContentDetailViewModel();
            int newsId      = id.Split("-".ToCharArray()).Last().ToInt();

            resultModel.SContent = ContentRepository.GetContentsContentId(newsId);

            if (!CheckRequest(resultModel.SContent))
            {
                throw new Exception("Not Found.Site content is wrong");
            }
            resultModel.Type         = contentType;
            resultModel.SStore       = MyStore;
            resultModel.SCategory    = CategoryRepository.GetCategory(resultModel.Content.CategoryId);
            resultModel.SCategories  = CategoryRepository.GetCategoriesByStoreId(MyStore.Id, contentType);
            resultModel.SNavigations = NavigationRepository.GetStoreActiveNavigations(this.MyStore.Id);
            resultModel.SSettings    = this.GetStoreSettings();

            return(resultModel);
        }
Пример #10
0
        public StoreHomePage GetHomePage()
        {
            int           page        = 1;
            StoreHomePage resultModel = new StoreHomePage();

            resultModel.SStore             = MyStore;
            resultModel.SCarouselImages    = FileManagerRepository.GetStoreCarousels(MyStore.Id);
            resultModel.SProductCategories = ProductCategoryRepository.GetProductCategoriesByStoreId(MyStore.Id);
            var products = ProductRepository.GetProductsCategoryId(MyStore.Id, null, StoreConstants.ProductType, true, page, 24);

            resultModel.SProducts = new PagedList <Product>(products.items, products.page - 1, products.pageSize, products.totalItemCount);
            var contents = ContentRepository.GetContentsCategoryId(MyStore.Id, null, StoreConstants.NewsType, true, page, 24);

            resultModel.SNews            = new PagedList <Content>(contents.items, contents.page - 1, contents.pageSize, contents.totalItemCount);
            contents                     = ContentRepository.GetContentsCategoryId(MyStore.Id, null, StoreConstants.BlogsType, true, page, 24);
            resultModel.SBlogs           = new PagedList <Content>(contents.items, contents.page - 1, contents.pageSize, contents.totalItemCount);
            resultModel.SBlogsCategories = CategoryRepository.GetCategoriesByStoreId(MyStore.Id, StoreConstants.BlogsType, true);
            resultModel.SNewsCategories  = CategoryRepository.GetCategoriesByStoreId(MyStore.Id, StoreConstants.NewsType, true);
            resultModel.SNavigations     = NavigationRepository.GetStoreActiveNavigations(this.MyStore.Id);
            resultModel.SSettings        = this.GetStoreSettings();


            return(resultModel);
        }
Пример #11
0
        public bool IsModulActive(string controllerName)
        {
            var navigations = NavigationRepository.GetStoreActiveNavigations(MyStore.Id);

            return(navigations.Any(r => r.ControllerName.ToLower().StartsWith(controllerName.ToLower())));
        }