예제 #1
0
        public async Task <ActionResult> Index(int categoryId, int?page)
        {
            DBModelContainer  db      = new DBModelContainer();
            ProductionService service = new ProductionService();

            // get all products of a given category
            List <Production> prs = await service.getProductsByCategoryId(categoryId);

            if (prs != null && prs.Count > 0)
            {
                int pageSize   = 16;
                int pageNumber = (page ?? 1);

                return(View(prs.ToPagedList(pageNumber, pageSize)));
            }

            return(RedirectToAction("Index", "Category"));
        }