public ActionResult IndexGallery(int?page, int TypeId = 0) { int defautPagesize = 10; int total = 0; int currentPageIndex = page.HasValue ? page.Value - 1 : 0; IGalleryService gallerySrv = IoC.Resolve <IGalleryService>(); GalleryModels model = new GalleryModels(); model.GalleryTypes = galleryTypeSrv.Query.OrderBy(p => p.TitleVNI).ToList(); model.TypeID = TypeId == 0 ? model.GalleryTypes.FirstOrDefault().Id : TypeId; var lst = gallerySrv.GetbyType(TypeId, currentPageIndex, defautPagesize, out total); model.Galleries = new PagedList <Gallery>(lst, currentPageIndex, defautPagesize, total); return(View(model)); }