Ejemplo n.º 1
0
        public JsonResult FindProduct(int?page, double size)
        {
            var model = new CategoryDao().GetListAllProduct();

            page = page ?? 1;
            int   start        = (int)(page - 1) * pageSize;
            int   totalPage    = model.Count();
            float totalNumsize = (totalPage / (float)pageSize);
            int   numSize      = (int)Math.Ceiling(totalNumsize);

            var filter = model.Skip(start).Take(pageSize).ToList();

            string data = HtmlMvcHelper.RenderViewToString(ControllerContext,
                                                           "~/Views/Shared/_LayoutListProduct.cshtml",
                                                           filter, true);

            return(Json(new
            {
                data = data,
                pageCurrent = page,
                numSize = numSize,
            }));
        }
Ejemplo n.º 2
0
        public JsonResult ProductPagination(int?page, string[] conditions)
        {
            var model = new CategoryDao().FilterProductBy(conditions);

            page = page ?? 1;
            int   start        = (int)(page - 1) * pageSize;
            int   totalPage    = model.Count();
            float totalNumsize = (totalPage / (float)pageSize);
            int   numSize      = (int)Math.Ceiling(totalNumsize);

            var filter = model.Skip(start).Take(pageSize).ToList();

            string dataHtml = HtmlMvcHelper.RenderViewToString(ControllerContext,
                                                               "~/Views/Shared/_LayoutListProduct.cshtml",
                                                               filter, true);

            return(Json(new
            {
                data = dataHtml,
                pageCurrent = page,
                numSize = numSize,
                conditions = conditions
            }));
        }