コード例 #1
0
        // GET: Store
        public ActionResult Index(string categoryId)
        {
            User user = (User)Session["User"];

            List <Item> products = new List <Item>();

            //only take 10 products...
            if (user != null)
            {
                string name   = user.Email;
                int    userId = user.UserId;
                products = RecommendationHelper.GetViaFunction("assoc", userId, 12);
            }
            else
            {
                products = RecommendationHelper.GetViaFunction("top", 0, 12);
            }

            var randomVm = Mapper.Map <List <Models.ProductListModel> >(RecommendationHelper.GetViaFunction("random", 0, 12));

            var productsVm = Mapper.Map <List <Models.ProductListModel> >(products);

            // Retrieve category listing:
            var categoriesVm = Mapper.Map <List <Models.CategoryModel> >(categories.ToList());

            var vm = new Models.StoreIndexModel
            {
                RandomProducts = randomVm,
                Products       = productsVm,
                Categories     = categoriesVm
            };

            return(View(vm));
        }
コード例 #2
0
        // GET: Store
        public ActionResult Index()
        {
            var products   = db.Products.Include(p => p.Category);
            var productsVm = Mapper.Map <List <Models.ProductListModel> >(products);

            // Retrieve category listing:
            var categories   = db.Categories.ToList();
            var categoriesVm = Mapper.Map <List <Models.CategoryModel> >(categories);

            var vm = new Models.StoreIndexModel
            {
                Products   = productsVm,
                Categories = categoriesVm
            };

            return(View(vm));
        }
コード例 #3
0
        public ActionResult Genre(int categoryId)
        {
            List <Item> products = SqlDbHelper.GetItemsByCategory(categoryId).ToList();

            var productsVm = Mapper.Map <List <Models.ProductListModel> >(products);

            // Retrieve category listing:
            var categoriesVm = Mapper.Map <List <Models.CategoryModel> >(categories.ToList());

            var vm = new Models.StoreIndexModel
            {
                Products   = productsVm,
                Categories = categoriesVm
            };

            return(View(vm));
        }
コード例 #4
0
        public ActionResult Genre(int categoryId)
        {
            var container = client.GetContainer(databaseId, "object");

            var query = container.GetItemLinqQueryable <Item>(true).Where(c => c.CategoryId == categoryId && c.EntityType == "Item");

            List <Item> products = query.ToList();

            var productsVm = Mapper.Map <List <Models.ProductListModel> >(products);

            // Retrieve category listing:
            var categoriesVm = Mapper.Map <List <Models.CategoryModel> >(categories.ToList());

            var vm = new Models.StoreIndexModel
            {
                Products   = productsVm,
                Categories = categoriesVm
            };

            return(View(vm));
        }
コード例 #5
0
        // GET: Store
        public ActionResult Index(string categoryId)
        {
            User user = (User)Session["User"];

            List <Item> products = RecommendationHelper.GetViaFunction("top", 0, 100);

            var randomVm = Mapper.Map <List <Models.ProductListModel> >(RecommendationHelper.GetViaFunction("random", 0, 10));

            var productsVm = Mapper.Map <List <Models.ProductListModel> >(products);

            // Retrieve category listing:
            var categoriesVm = Mapper.Map <List <Models.CategoryModel> >(categories.ToList());

            var vm = new Models.StoreIndexModel
            {
                RandomProducts = randomVm,
                Products       = productsVm,
                Categories     = categoriesVm
            };

            return(View(vm));
        }