예제 #1
0
        public async Task OnGetAsync(string searchString, int?currentPage, int?sizePage)
        {
            var idUserCookie = (((ClaimsIdentity)User.Identity).FindFirst(ClaimTypes.NameIdentifier).Value);
            int idUsuario    = Convert.ToInt32(idUserCookie);

            if (searchString != null)
            {
                var totalItems = await _repository.CountAsync(new Paquete_UserSpec(new Paquete_Filter {
                    UserId = idUsuario, Contenido_Paquete = searchString, LoadChildren = false, IsPagingEnabled = true
                }));

                UIPagination = new UIPaginationModel(currentPage, searchString, sizePage, totalItems);

                Paquetes = await _repository.ListAsync(new Paquete_Spec(
                                                           new Paquete_Filter
                {
                    IsPagingEnabled = true,
                    Contenido_Paquete = UIPagination.SearchString,
                    SizePage = UIPagination.GetSizePage,
                    Page = UIPagination.GetCurrentPage
                })
                                                       );
            }
            Paquetes = await _repository.ListAsync(new Paquete_UserSpec(new Paquete_Filter {
                UserId = idUsuario
            }));
        }
예제 #2
0
        public async Task OnGet(string searchString, int?currentPage, int?sizePage)
        {
            try
            {
                var totalItems = await _repository.CountAsync(new TipoNegocioSpec(
                                                                  new TipoNegocioFilter
                {
                    Nombre = searchString,
                    LoadChildren = false,
                    IsPagingEnabled = true
                }));

                UIPagination = new UIPaginationModel(currentPage, searchString, sizePage, totalItems);
                TiposNegocio = await _repository.ListAsync(new TipoNegocioSpec(
                                                               new TipoNegocioFilter
                {
                    IsPagingEnabled = true,
                    Nombre = UIPagination.SearchString,
                    PageSize = UIPagination.GetPageSize,
                    Page = UIPagination.GetCurrentPage,
                    LoadChildren = false
                }
                                                               ));
            }
            catch (Exception ex)
            {
                _logger.LogWarning(ex.Message);
                throw;
            }
        }
예제 #3
0
        public async Task OnGetAsync(string searchString, string typeFilter, int?currentPage, int?sizePage)
        {
            if (typeFilter == "")
            {
                typeFilter = "Alquiler";
            }

            var totalItems = await _repository.CountAsync(new AlquilerSpec(new AlquilerFilter {
                LoadChildren = true, IsPagingEnabled = true
            }));

            UIPagination = new UIPaginationModel(currentPage, searchString, sizePage, totalItems);

            Alquileres = await _repository.ListAsync(new AlquilerSpec(
                                                         new AlquilerFilter
            {
                IsPagingEnabled = true,
                TypeFilter = typeFilter,
                SearchString = searchString,
                // = UIPagination.SearchString,
                SizePage = UIPagination.GetSizePage,
                Page = UIPagination.GetCurrentPage,
                LoadChildren = true
            })
                                                     );
        }
예제 #4
0
        public async Task <IActionResult> OnGetAsync(int?categoriaId, string searchString, int?currentPage, int?sizePage)
        {
            try
            {
                if (!categoriaId.HasValue)
                {
                    _notifyService.Warning($"Debe selecionar una categoria para ver sus negocios");
                    return(RedirectToPage("Index", new { area = "Categorias" }));
                }

                Categoria = await _categoriaRepository.GetByIdAsync(categoriaId.Value);

                if (Categoria == null)
                {
                    _notifyService.Warning($"No se ha encontrado una categoria con el id {categoriaId.Value}");
                    return(RedirectToPage("Index", new { area = "Categorias" }));
                }

                var totalItems = await _repository.CountAsync(new NegocioSpec(
                                                                  new NegocioFilter
                {
                    CategoriaId = categoriaId.Value,
                    Nombre = searchString,
                    LoadChildren = false,
                    IsPagingEnabled = true
                }));

                UIPagination = new UIPaginationModel(currentPage, searchString, sizePage, totalItems);
                Negocios     = await _repository.ListAsync(new NegocioSpec(
                                                               new NegocioFilter
                {
                    IsPagingEnabled = true,
                    Nombre = UIPagination.SearchString,
                    CategoriaId = categoriaId.Value,
                    PageSize = UIPagination.GetPageSize,
                    Page = UIPagination.GetCurrentPage,
                    LoadChildren = true
                })
                                                           );

                return(Page());
            }
            catch (Exception ex)
            {
                _logger.LogWarning(ex.Message);
                return(RedirectToPage("Index", new { area = "Categorias" }));
            }
        }
예제 #5
0
        public async Task OnGetAsync(string searchString, int?currentPage, int?sizePage)
        {
            var totalItems = await _repository.CountAsync(new AutoSpec(new AutoFilter {
                Marca = searchString, LoadChildren = false, IsPagingEnabled = true
            }));

            UIPagination = new UIPaginationModel(currentPage, searchString, sizePage, totalItems);

            Auto = await _repository.ListAsync(new AutoSpec(
                                                   new AutoFilter
            {
                IsPagingEnabled = true,
                Marca = UIPagination.SearchString,
                SizePage = UIPagination.GetSizePage,
                Page = UIPagination.GetCurrentPage
            })
                                               );
        }