public IActionResult Search(string searchString, int?categoryId, ProductTypeStatus?status, string dateModified, ProductStatus?productStatus, short?page = 1)
        {
            DateTime?convertedDateModified = null;

            if (!string.IsNullOrWhiteSpace(dateModified))
            {
                try
                {
                    convertedDateModified = DateTime.ParseExact(dateModified, "yyyy-MM-dd", null);
                }
                catch
                { }
            }
            ProductTypeSearchModel searchModel = new ProductTypeSearchModel
            {
                SearchString  = searchString,
                CategoryId    = categoryId,
                Status        = status,
                DateModified  = convertedDateModified,
                ProductStatus = productStatus
            };

            ViewData[GlobalViewBagKeys.ECommerceService] = eCommerce;
            return(View(new ProductTypesListViewModel
            {
                ProductTypes = eCommerce.GetProductTypesBy(searchModel, (page - 1) * recordsPerPage, recordsPerPage),
                PagingInfo = new PagingInfo
                {
                    CurrentPage = (short)page,
                    RecordsPerPage = recordsPerPage,
                    TotalRecords = eCommerce.CountProductTypesBy(searchModel)
                },
                SearchModel = searchModel
            }));
        }
Exemplo n.º 2
0
        public IActionResult Index(string searchString, int?categoryId = null, short?page = 1)
        {
            ProductTypeSearchModel searchModel = new ProductTypeSearchModel
            {
                SearchString     = searchString,
                CategoryId       = categoryId,
                Status           = ProductTypeStatus.Active,
                ProductStatus    = ProductStatus.Active,
                HasActiveProduct = true
            };

            ViewData[GlobalViewBagKeys.ECommerceService] = eCommerce;
            return(View(new ProductsListViewModel
            {
                Products = eCommerce.GetProductTypesBy(searchModel, (page - 1) * recordsPerPage, recordsPerPage)
                           .Select(p => eCommerce.GetRepresentativeProduct(int.Parse(p.Id))),
                PagingInfo = new PagingInfo
                {
                    CurrentPage = (short)page,
                    RecordsPerPage = recordsPerPage,
                    TotalRecords = eCommerce.CountProductTypesBy(searchModel)
                },
                SearchModel = new ProductSearchModel
                {
                    SearchString = searchString,
                    CategoryId = categoryId
                }
            }));
        }
Exemplo n.º 3
0
        public IActionResult SelectProductType(string searchString, short?page = 1)
        {
            ProductTypeSearchModel searchModel = new ProductTypeSearchModel
            {
                SearchString = searchString,
                Status       = ProductTypeStatus.Active
            };

            ViewData[GlobalViewBagKeys.ECommerceService] = eCommerce;
            ViewBag.Action     = "Index";        //for select product type table display template
            ViewBag.Controller = "RegisterProduct";
            return(View(new ProductTypesListViewModel
            {
                ProductTypes = eCommerce.GetProductTypesBy(searchModel, (page - 1) * recordsPerPage, recordsPerPage),
                PagingInfo = new PagingInfo
                {
                    CurrentPage = (short)page,
                    RecordsPerPage = recordsPerPage,
                    TotalRecords = eCommerce.CountProductTypesBy(searchModel)
                },
                SearchModel = searchModel
            }));
        }