コード例 #1
0
        public async Task <IActionResult> PaginationUser(int?pageNumber)
        {
            if (pageNumber == null)
            {
                pageNumber = 1;
            }
            var lista = await _service.GetAll();

            var itensPorPagina = 5;
            PaginatedList <User> listaPaginada = PaginatedList <User> .Create(lista, pageNumber ?? 1, itensPorPagina);

            return(PartialView("_TabelaUsuarios", listaPaginada));
        }
コード例 #2
0
        public async Task <IActionResult> Index(int?pageNumber)
        {
            ViewBag.Mensagem = TempData.Get <string>("mensagem");

            var listaModelo = await _service.BuscarTodos();

            int pageSize = 10;
            PaginatedList <Cliente> ModelComPaginacao = PaginatedList <Cliente> .Create(listaModelo, pageNumber ?? 1, pageSize);

            ViewBag.ListaIdClienteComDadosCadastrados = await _serviceDadosCliente.ListaIdClienteComDadosCadastrados();

            return(View(ModelComPaginacao));
        }
コード例 #3
0
        public async Task <IActionResult> SearchUser(int?pageNumber, string param)
        {
            if (param == null)
            {
                param = "";
            }
            var lista = await _service.Search(param);

            var itensPorPagina = 5;
            PaginatedList <User> listaPaginada = PaginatedList <User> .Create(lista, pageNumber ?? 1, itensPorPagina);

            return(PartialView("_TabelaUsuarios", listaPaginada));
        }
コード例 #4
0
        public ActionResult Manage(int?page, int?items, string sortOrder, string currentFilter)
        {
            ViewData["IdSortParm"]   = String.IsNullOrEmpty(sortOrder) ? "id_desc" : "";
            ViewData["NameSortParm"] = sortOrder == "name" ? "name_desc" : "name";
            ViewData["TypeSortParm"] = sortOrder == "type" ? "type_desc" : "type";
            var ImageTypes = _imageTypeService.FilterSearch(currentFilter);

            ImageTypes = _imageTypeService.SortList(sortOrder, ImageTypes);
            var result = PaginatedList <ImageType> .Create(ImageTypes.AsNoTracking(), page, items);

            result.Pagination.Configure("manage", currentFilter, sortOrder);
            return(View(result));
        }
コード例 #5
0
        public IActionResult Index(int?page)
        {
            var users          = this.UserManager.GetUsersInRoleAsync("User").Result;
            var usersRolesDTOs = users.Select(au => new UserRoleDTO()
            {
                Email = au.Email, Role = "User", ToGiveAdminRights = false
            }).ToList();


            var pagenatedList = PaginatedList <UserRoleDTO> .Create(usersRolesDTOs, page ?? 1, GlobalConstants.pageSize);

            return(View(pagenatedList));
        }
コード例 #6
0
        // GET: Employees/Service
        public async Task <IActionResult> Index(string sortOrder, int pageNumber = 1)
        {
            List <ServiceDTO>       data   = _mapper.Map <List <ServiceDTO> >(await _repositoryWrapper.Service.GetAllServicesAsync());
            IQueryable <ServiceDTO> sorted = data.AsQueryable();

            ViewData["ServiceNameSortParm"] = string.IsNullOrEmpty(sortOrder) ? "service_name_desc" : "";
            ViewData["currentSort"]         = sortOrder;

            sorted = SortList(sortOrder, sorted);
            var model = PaginatedList <ServiceDTO> .Create(sorted, pageNumber, 5);

            return(View(nameof(Index), model));
        }
コード例 #7
0
        public async Task <IActionResult> Index(int?pageNumber)
        {
            List <Medic> medics = await _getMedics.GetMedics();

            List <Turn> turns;

            turns = await TurnListAsync(null, null);

            ViewBag.Medics = medics;
            var size = 10;

            return(View(PaginatedList <Turn> .Create(turns, pageNumber ?? 1, size)));
        }
コード例 #8
0
        public async Task <IActionResult> Index(int?pageNumber)
        {
            ViewBag.Mensagem = TempData.Get <string>("mensagem");

            var listaModelo = await _service.BuscarTodos();

            int pageSize = 10;
            PaginatedList <Banco> ModelComPaginacao = PaginatedList <Banco> .Create(listaModelo, pageNumber ?? 1, pageSize);

            ViewBag.ListaNomeBancoComPercentuaisCadastrados = await _serviceBancoPercentual.ListaNomeBancoComPercentuaisCadastrados();

            return(View(ModelComPaginacao));
        }
コード例 #9
0
        public IActionResult OnGetArticleRecent(int?pageIndex)
        {
            ViewData["CategoryId"] = new SelectList(_context.Category, "CategoryId", "CategoryName");
            IQueryable <Data.Article> studentIQ2 = from s in _context.Article.Where(d => d.ArticleVisible == true).OrderByDescending(s => s.ArticleCreated).Include(c => c.ArticlePictures)
                                                   select s;

            int pageSize = 5;

            articlesRecent = PaginatedList <Data.Article> .Create(
                studentIQ2.AsNoTracking(), pageIndex ?? 1, pageSize);

            return(Page());
        }
コード例 #10
0
        public IActionResult OnGetArticlePopular(int?pageIndex)
        {
            ViewData["CategoryId"] = new SelectList(_context.Category, "CategoryId", "CategoryName");

            IQueryable <Data.Article> studentIQ3 = from s in _context.Article.Where(d => d.ArticleVisible == true).Include(d => d.ArticlePictures).Include(a => a.Reviews).OrderByDescending(a => a.Reviews.Count()).Where(a => DateTime.Compare(a.ArticleCreated, DateTime.Today.AddMonths(-4)) >= 0)
                                                   select s;
            int pageSize = 5;

            articlesPopularParentPaginatedList = PaginatedList <Data.Article> .Create(
                studentIQ3.AsNoTracking(), pageIndex ?? 1, pageSize);

            return(Page());
        }
コード例 #11
0
        public IActionResult Index(string sortOrder, string currentFilter, string searchString, int?page)
        {
            ViewData["DateSortParm"]     = String.IsNullOrEmpty(sortOrder) ? "date_asc" : "";
            ViewData["CodeSortParm"]     = String.IsNullOrEmpty(sortOrder) ? "code_asc" : "";
            ViewData["LocationSortParm"] = String.IsNullOrEmpty(sortOrder) ? "location_asc" : "";
            ViewData["AddressSortParm"]  = String.IsNullOrEmpty(sortOrder) ? "addr_asc" : "";

            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewData["CurrentFilter"] = searchString;

            var branches = _branchService.List();

            if (!String.IsNullOrEmpty(searchString))
            {
                branches = branches.Where(s => s.BranchCode.Contains(searchString) ||
                                          s.Location.Contains(searchString) ||
                                          s.Address.Contains(searchString));
            }
            switch (sortOrder)
            {
            case "date_asc":
                branches = branches.OrderBy(s => s.DateCreated);
                break;

            case "code_asc":
                branches = branches.OrderBy(s => s.BranchCode);
                break;

            case "location_asc":
                branches = branches.OrderBy(s => s.Location);
                break;

            case "addr_asc":
                branches = branches.OrderBy(s => s.Address);
                break;

            default:
                branches = branches.OrderByDescending(s => s.DateCreated);
                break;
            }

            return(View(PaginatedList <BranchModel> .Create((IEnumerable <BranchModel>)branches, page ?? 1, 10)));
        }
コード例 #12
0
        // GET: Dashboard/Contacts
        public async Task <IActionResult> Index(
            string sortOrder,
            string currentFilter,
            string searchString,
            int?page)
        {
            ViewData["CurrentSort"]     = sortOrder;
            ViewData["NameSortParm"]    = string.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewData["DateSortParm"]    = sortOrder == "Date" ? "date_desc" : "Date";
            ViewData["SubjectSortParm"] = sortOrder == "Subject" ? "sub_desc" : "Subject";

            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewData["CurrentFilter"] = searchString;
            var contacts = _repository.GetAll().Where(c => string.IsNullOrEmpty(searchString) || c.Email.Contains(searchString) || c.Name.Contains(searchString));

            switch (sortOrder)
            {
            case "name_desc":
                contacts = contacts.OrderByDescending(c => c.Email);
                break;

            case "Date":
                contacts = contacts.OrderBy(c => c.Date);
                break;

            case "name":
                contacts = contacts.OrderBy(c => c.Email);
                break;

            case "Subject":
                contacts = contacts.OrderBy(c => c.Subject);
                break;

            case "sub_desc":
                contacts = contacts.OrderByDescending(c => c.Subject);
                break;

            default:
                contacts = contacts.OrderByDescending(c => c.Date);
                break;
            }
            return(View(await PaginatedList <Contact> .Create(contacts, page ?? 1, 5)));
        }
コード例 #13
0
ファイル: UserController.cs プロジェクト: yogesisdead/EF-Core
        public IActionResult ShowUser(
            string sortOrder,
            string searchString,
            string currentFilter,
            int?pageNumber)
        {
            ViewData["NameSortParm"]  = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewData["EmailSortParm"] = String.IsNullOrEmpty(sortOrder) ? "email_desc" : "";
            ViewData["CurrentFilter"] = searchString;
            ViewData["CurrentSort"]   = sortOrder;
            var cookieToken = HttpContext.User.Claims.First(c => c.Type == "_token").Value;
            IEnumerable <UserModel> userList;
            var _http = client.CreateClient("apiClient");

            _http.DefaultRequestHeaders.Authorization =
                new AuthenticationHeaderValue("Bearer", cookieToken);
            var response = _http.GetAsync("User/GetAllUsers").Result;

            userList = response.Content.ReadAsAsync <IEnumerable <UserModel> >().Result;
            if (searchString != null)
            {
                pageNumber = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            if (!String.IsNullOrEmpty(searchString))
            {
                userList = userList.Where(s => s.UserFullName.Contains(searchString) ||
                                          s.UserEmailID.Contains(searchString));
            }
            switch (sortOrder)
            {
            case "name_desc":
                userList = userList.OrderByDescending(s => s.UserFullName);
                break;

            case "email_desc":
                userList = userList.OrderByDescending(s => s.UserEmailID);
                break;

            default:
                userList = userList.OrderBy(s => s.UserFullName);
                break;
            }
            int pageSize = 15;

            // return View(userList);
            return(View(PaginatedList <UserModel> .Create(userList, pageNumber ?? 1, pageSize)));
        }
コード例 #14
0
        /*
         * // GET: JobEntities
         * public async Task<IActionResult> Index()
         * {
         *  return View(await jobslogic.ListJobs());
         * }*/


        // GET: JobEntities
        public async Task <IActionResult> Index(
            string sortOrder,
            string currentFilter,
            string searchString,
            int?pageNumber)
        {
            ViewData["CurrentSort"]  = sortOrder;
            ViewData["NameSortParm"] = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewData["DateSortParm"] = sortOrder == "Date" ? "date_desc" : "Date";

            if (searchString != null)
            {
                pageNumber = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            ViewData["CurrentFilter"] = searchString;

            var jobsTask = await jobslogic.ListJobs();

            var jobs = jobsTask.AsQueryable();

            if (!String.IsNullOrEmpty(searchString))
            {
                jobs = jobs.Where(s => s.Title.Contains(searchString, StringComparison.InvariantCultureIgnoreCase));
            }
            switch (sortOrder)
            {
            case "name_desc":
                jobs = jobs.OrderByDescending(s => s.Title);
                break;

            case "Date":
                jobs = jobs.OrderBy(s => s.CreatedAt);
                break;

            case "date_desc":
                jobs = jobs.OrderByDescending(s => s.CreatedAt);
                break;

            default:
                jobs = jobs.OrderBy(s => s.Description);
                break;
            }

            int pageSize = 7;

            return(View(PaginatedList <JobEntity> .Create(jobs.AsNoTracking(), pageNumber ?? 1, pageSize)));
        }
コード例 #15
0
        public PartialViewResult ProductPartial(string sortOrder, string searchString, int?page, bool forOwner, string userId)
        {
            if (searchString != null)
            {
                page = 1;
            }

            IEnumerable <Product> pr;

            if (forOwner)
            {
                if (userId != _userProfileManager.GetUserProfileId(User))
                {
                    throw new Exception("User ids doesn't match");
                }
                pr = _userProfileManager.GetAllProductByOwner(User);
            }
            else
            {
                pr = _productsManager.GetAll();
            }

            var products = ConvertToViewModel(_userProfileManager.GetUserProfileId(User), pr);

            if (!string.IsNullOrEmpty(searchString))
            {
                searchString = searchString.Trim().ToLower();
                products     = products.Where(s => s.Description.ToLower().Contains(searchString));
            }

            switch (sortOrder)
            {
            case "price_desc":
                products = products.OrderByDescending(p => p.Price);
                break;

            case "date_asc":
                products = products.OrderBy(p => p.CreatedOn);
                break;

            case "date_desc":
                products = products.OrderByDescending(p => p.CreatedOn);
                break;

            default:
                products = products.OrderBy(p => p.Price);
                break;
            }

            return(PartialView(PaginatedList <ProductViewModel> .Create(products.AsQueryable(), page ?? 1, ITEMS_ON_PAGE)));
        }
コード例 #16
0
        public IActionResult All(int?pageIndex)
        {
            var matchdays = this.matchdayService
                            .All <MatchdayViewModel>()
                            .OrderBy(x => x.Week)
                            .ToList();

            var paginatedMatchdays = PaginatedList <MatchdayViewModel> .Create(
                matchdays,
                pageIndex ?? 1,
                GlobalConstants.MatchdaysPageSize);

            return(View(paginatedMatchdays));
        }
コード例 #17
0
        public IActionResult Pending(int?pageNumber)
        {
            var pendingOrders = this.orderService
                                .GetOrdersByStatus <OrderByStatusViewModel>(OrderStatus.Pending, this.User.Identity.Name);

            if (pendingOrders.Count == 0)
            {
                return(Redirect("NoOrders"));
            }

            int pageSize = GlobalConstants.DefaultPageSize;

            return(this.View(PaginatedList <OrderByStatusViewModel> .Create(pendingOrders, pageNumber ?? 1, pageSize)));
        }
コード例 #18
0
        public ActionResult Manage(int?page, int?items, string sortOrder, string currentFilter)
        {
            ViewData["IdSortParm"]   = String.IsNullOrEmpty(sortOrder) ? "id_desc" : "";
            ViewData["NameSortParm"] = sortOrder == "name" ? "name_desc" : "name";

            var listTypes = _listTypeService.FilterSearch(currentFilter);

            listTypes = _listTypeService.SortList(sortOrder, listTypes);
            var result = PaginatedList <ListType> .Create(listTypes.AsNoTracking(), page, items);

            result.Pagination.Configure(
                this.ControllerContext.ActionDescriptor.ActionName.ToString(), currentFilter, sortOrder);
            return(View(result));
        }
コード例 #19
0
        public async Task <IActionResult> Index(string sortOrder, string currentFilter, string searchString, int?pageNumber)
        {
            ViewBag.Title = "Tipo Visualização";

            ViewData["CurrentSort"]            = sortOrder;
            ViewData["TipoVisualSortParm"]     = String.IsNullOrEmpty(sortOrder) ? "tipo_visual" : "";
            ViewData["DescTipoVisualSortParm"] = sortOrder == "Tipo" ? "tipovisual_desc" : "Tipo";

            if (searchString != null)
            {
                pageNumber = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewData["CurrentFilter"] = searchString;

            var tipovisual = await _tipovisualRepo.GetAsync();

            if (!String.IsNullOrEmpty(searchString))
            {
                tipovisual = tipovisual.Where(s => s.Tipo.ToUpper().Contains(searchString.ToUpper()) ||
                                              s.Descricao.ToUpper().Contains(searchString.ToUpper()));
            }

            switch (sortOrder)
            {
            case "tipo_visual":
                tipovisual = tipovisual.OrderByDescending(s => s.Tipo);
                break;

            case "Tipo":
                tipovisual = tipovisual.OrderBy(s => s.Descricao);
                break;

            case "tipovisual_desc":
                tipovisual = tipovisual.OrderByDescending(s => s.Descricao);
                break;

            default:
                tipovisual = tipovisual.OrderBy(s => s.Descricao);
                break;
            }

            int pageSize = 20; // Número de registros por Página

            return(View(PaginatedList <TipoVisualizacao> .Create(tipovisual.AsQueryable(), pageNumber ?? 1, pageSize)));
        }
コード例 #20
0
        public override BusquedaPaginada <Sector> obtenerPaginados(int?pagina, int cant)
        {
            var sectores = this._context.Sector
                           .Include(sector => sector.TipoSector)
                           .OrderByDescending(s => s.FecModificacion)
                           .Where(s => s.TipoSector.Nombre == "Jurisdiccion");


            var results = PaginatedList <Sector> .Create(sectores.AsNoTracking(), pagina ?? 1, cant);

            var response = BusquedaPaginada <Sector> .Create(results);

            return(response);
        }
コード例 #21
0
        public IActionResult Get([FromQuery] DateTime?startDate, [FromQuery] DateTime?endDate, [FromQuery] int?pageIndex, [FromQuery] int?pageSize)
        {
            try
            {
                var logs   = _logic.Get(startDate ?? DateTime.Now.AddYears(-10), endDate ?? DateTime.Now.AddYears(10));
                var retval = PaginatedList <KeywordCount> .Create(logs, pageIndex, pageSize);

                return(logs.Count() > 0 ? (IActionResult) new OkObjectResult(retval) : new NotFoundResult());
            }
            catch (Exception)
            {
                return(new ForbidResult());
            }
        }
コード例 #22
0
        /// <summary>
        /// Liste les articles
        /// </summary>
        /// <returns>Vue avec collection de produits</returns>

        public IActionResult Index(int?pageNumber)
        {
            //Récupère tous les produits
            var prods = _repo.FindAll().AsQueryable();

            //Pagination

            ViewBag.Titre       = "Liste des articles";
            ViewBag.totalPanier = _session.totalPanier();

            int pageSize = 6;

            return(View(PaginatedList <Produit> .Create(prods, pageNumber ?? 1, pageSize)));
        }
コード例 #23
0
        public IActionResult OnGet(int?pageNumber)
        {
            int pagesize       = 5;
            var listeDeChambre = HttpContext.Session.GetObjectFromJson <IEnumerable <Chambre> >("ListeDeChambre");

            if (listeDeChambre != null)
            {
                Chambre  = listeDeChambre;
                Chambres = PaginatedList <Chambre> .Create(Chambre, pageNumber ?? 1, pagesize);

                return(Page());
            }
            return(RedirectToPage("../Reservations/CreateReservation"));
        }
コード例 #24
0
        public async Task <IActionResult> All(int?pageIndex)
        {
            var products = await this.productsService
                           .All <ProductViewModel>();

            int pageSize = 6;

            var paginatedProducts = PaginatedList <ProductViewModel> .Create(
                products,
                pageIndex ?? 1,
                pageSize);

            return(View(paginatedProducts));
        }
コード例 #25
0
        public IndexVm GetProductListVm(string searchString, string brand, string category, int pageIndex = 1, int pageSize = 5, int?status = null)
        {
            var products   = _service.GetAllProduct(searchString, brand, category, status);
            var brands     = _service.GetBrands();
            var categories = _service.GetCategories();

            return(new IndexVm
            {
                Total = products.Count(),
                brand = new SelectList(brands, "Key", "Value"),
                category = new SelectList(categories, "Key", "Value"),
                Products = PaginatedList <ProductDto> .Create(products, pageIndex, pageSize)
            });
        }
コード例 #26
0
ファイル: Index.xaml.cs プロジェクト: jtzhang163/Arthur
        private void UpdateDataGrid(int index)
        {
            var dtos = PaginatedList <GMCC.Sorter.Model.TaskLog> .Create(TaskLogs, PageIndex, Arthur.App.Current.Option.DataGridPageSize);

            this.count.Content          = TaskLogs.Count();
            this.pageIndex.Content      = PageIndex;
            this.totalPages.Content     = dtos.TotalPages;
            this.size.Content           = Arthur.App.Current.Option.DataGridPageSize;
            this.tbPageIndex.Text       = PageIndex.ToString();
            this.preview_page.IsEnabled = dtos.HasPreviousPage;
            this.next_page.IsEnabled    = dtos.HasNextPage;

            this.dataGrid.ItemsSource = dtos;
        }
コード例 #27
0
        public DoctorPageVM GetDoctorPageViewModel(string searchString, int pageIndex = 1)
        {
            var names = _unitOfWork.Doctors.GetNames();

            var rs = _unitOfWork.Doctors.GetAll();

            var doctors = _mapper.Map <IEnumerable <Doctor>, IEnumerable <DoctorsDTO> >(rs);

            return(new DoctorPageVM
            {
                Names = new SelectList(names),
                ListDoctor = PaginatedList <DoctorsDTO> .Create(doctors, pageIndex, pageSize)
            });
        }
コード例 #28
0
        public async Task <IActionResult> Index(string sortOrder, string currentFilter, string searchString, int?pageNumber)
        {
            ViewBag.Title = "Departamentos";

            ViewData["CurrentSort"]       = sortOrder;
            ViewData["CodDeptoSortParm"]  = String.IsNullOrEmpty(sortOrder) ? "cod_depto" : "";
            ViewData["DescDeptoSortParm"] = sortOrder == "Depto" ? "depto_desc" : "Depto";

            if (searchString != null)
            {
                pageNumber = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewData["CurrentFilter"] = searchString;

            var depto = await _deptoRepo.GetAsync();

            if (!String.IsNullOrEmpty(searchString))
            {
                depto = depto.Where(s => s.COD_DEPTO.ToUpper().Contains(searchString.ToUpper()) ||
                                    s.DS_DEPTO.ToUpper().Contains(searchString.ToUpper()));
            }

            switch (sortOrder)
            {
            case "cod_depto":
                depto = depto.OrderByDescending(s => s.COD_DEPTO);
                break;

            case "Depto":
                depto = depto.OrderBy(s => s.DS_DEPTO);
                break;

            case "depto_desc":
                depto = depto.OrderByDescending(s => s.DS_DEPTO);
                break;

            default:
                depto = depto.OrderBy(s => s.COD_DEPTO);
                break;
            }

            int pageSize = 20; // Número de registros por Página

            return(View(PaginatedList <SOL_Depto> .Create(depto.AsQueryable(), pageNumber ?? 1, pageSize)));
        }
コード例 #29
0
        // GET: Staff/Event
        public async Task <IActionResult> Index(string sortOrder, int pageNumber = 1)
        {
            List <EventManagementDTO>       data   = _mapper.Map <List <EventManagementDTO> >(await _repositoryWrapper.Event.GetAllEventsAsync()).ToList();
            IQueryable <EventManagementDTO> sorted = data.AsQueryable();

            ViewData["TitleSortParm"]  = string.IsNullOrEmpty(sortOrder) ? "title_desc" : "";
            ViewData["TimeSortParm"]   = sortOrder == "Time" ? "time_desc" : "Time";
            ViewData["ActiveSortParm"] = sortOrder == "Active" ? "active_desc" : "Active";
            ViewData["currentSort"]    = sortOrder;
            sorted = SortList(sortOrder, sorted);
            var model = PaginatedList <EventManagementDTO> .Create(sorted, pageNumber, 5);

            return(View(nameof(Index), model));
        }
コード例 #30
0
        public IActionResult Index(string sortOrder, string searchString, int?page)
        {
            string sort   = String.IsNullOrEmpty(sortOrder) ? "name_asc" : sortOrder;
            string search = String.IsNullOrEmpty(searchString) ? "" : searchString;

            ViewData["CurrentSort"]   = sort;
            ViewData["CurrentFilter"] = search;

            var resturants = repo.getAll(sort, search);
            int pageSize   = 2;

            return(View(PaginatedList <CuisinResturantVM> .Create(resturants
                                                                  , page ?? 1, pageSize)));
        }