Ejemplo n.º 1
0
        // GET: Warranty
        public ActionResult Index(int page = 1)
        {
            int pageSize = int.Parse(ConfigHelper.GetKey("PageSize"));

            int totalRow = 0;

            var warrantiesModel = _warrantyService.GetAllPaging(out totalRow, page, pageSize, new string[] { "Asset" });

            int totalPage = (int)Math.Ceiling((double)totalRow / pageSize);

            var warrantyViewModel = Mapper.Map <IEnumerable <Warranty>, IEnumerable <WarrantyViewModel> >(warrantiesModel);

            var paginationSet = new PaginationSet <WarrantyViewModel>()
            {
                Items      = warrantyViewModel,
                MaxPage    = int.Parse(ConfigHelper.GetKey("MaxSize")),
                Page       = page,
                TotalCount = totalRow,
                TotalPages = totalPage
            };

            ViewBag.query = new
            {
                page = page
            };

            return(View(paginationSet));
        }