示例#1
0
        public IActionResult Index([FromQuery] SearchEvents dto)
        {
            int    TotalItems     = 0;
            string ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString();

            dto.ItemsPerPage = 12;
            EventsModel data = new EventsModel()
            {
                SearchData = dto
            };

            data.ListItems = EventsService.GetListPaginationHome(data.SearchData, API.Models.Settings.SecretId + ControllerName);

            if (data.ListItems != null && data.ListItems.Count() > 0)
            {
                TotalItems = data.ListItems[0].TotalRows;
            }
            data.Pagination = new Areas.Admin.Models.Partial.PartialPagination()
            {
                CurrentPage = data.SearchData.CurrentPage, ItemsPerPage = data.SearchData.ItemsPerPage, TotalItems = TotalItems, QueryString = Request.QueryString.ToString()
            };

            return(View(data));
        }