コード例 #1
0
        public PartialViewResult GetProducts(string searchString, int sortType)
        {
            ProductSort sort = TempData["sort"] as ProductSort;

            TempData.Keep();
            if (searchString != "`")
            {
                sort.SearchString = searchString;
            }
            sort.GetSort(sortType);
            TempData["sort"] = sort;
            TempData.Keep();
            List <ProductView> products = new List <ProductView>();

            if (!String.IsNullOrEmpty(sort.SearchString))
            {
                foreach (var p in serviceProducts.Sort(serviceProducts.ProductSearch(sort.SearchString), sort.Sort, sort.GetOrder()))
                {
                    products.Add(new ProductView(p));
                }
            }
            else
            {
                foreach (var p in serviceProducts.Sort(serviceProducts.GetProducts(), sort.Sort, sort.GetOrder()))
                {
                    products.Add(new ProductView(p));
                }
            }
            return(PartialView(products));
        }
コード例 #2
0
        // GET: Products
        public async Task <IActionResult> Index(int page = 1, int itemsPerPage = 10)
        {
            DistributionPerPage distributionPerPage = new DistributionPerPage();

            distributionPerPage.recordCount = await _serviceProducts.GetCount();

            distributionPerPage.itemsPerPage = itemsPerPage;
            distributionPerPage.page         = page;

            distributionPerPage.CalculateDistribution();

            ViewData["PagesCount"]     = int.Parse(distributionPerPage.pageCount.ToString());
            ViewData["page"]           = distributionPerPage.page;
            ViewData["PageStart"]      = distributionPerPage.PageStart;
            ViewData["PagingItems"]    = distributionPerPage.itemsPerPage;
            ViewData["ControllerName"] = "Products";

            var _results = await _serviceProducts.GetProducts(page, itemsPerPage);

            return(View(_results));
        }
コード例 #3
0
        // GET: SupplyViews/Create
        public ActionResult Create()
        {
            SupplyEdit supplyEdit = new SupplyEdit(serviceProducts.GetProducts(), serviceProviders.GetProviders());

            return(View(supplyEdit));
        }
コード例 #4
0
        // GET: SaleViews/Create
        public ActionResult Create()
        {
            SaleEdit saleEdit = new SaleEdit(serviceProducts.GetProducts(), serviceCustomers.GetCustomers());

            return(View(saleEdit));
        }