// GET: MaterialSupplies public async Task <IActionResult> Index([FromQuery] int page = 1) { page--; var cnt = _context.MaterialSupplies.Count(); return(View(new DataViewModel <MaterialSupply>() { Data = _cachedService.GetMaterialSupply().Skip(page * _pSize).Take(_pSize), PageCount = cnt / _pSize + (cnt % _pSize > 0 ? 1 : 0), CurrentPage = page })); }
public async Task <ActionResult <IEnumerable <Material_supply> > > GetMaterial_supply([FromQuery] int page = 1) { page--; var cnt = _context.Material_supply.Count(); return(View("Get", new DataViewModel <Material_supply>() { Data = _cachedService.GetMaterialSupply(page, _size), PageCount = cnt / _size + (cnt % _size > 0 ? 1 : 0), CurrentPage = page })); }
// GET: MaterialSupplies public async Task <IActionResult> Index([FromQuery] int page = 1) { Func <MaterialSupply, bool> filter = a => true; if (Request.Cookies.ContainsKey("MSypFilter")) { var filterValue = Request.Cookies["MSypFilter"].Trim().ToLower(); if (!string.IsNullOrWhiteSpace(filterValue)) { filter = a => a.Provider.ToLower().Contains(filterValue) || a.Material.ToString().Contains(filterValue) || a.PriceOfMaterials.ToString().Contains(filterValue) || a.AmountOfMaterial.ToString().Contains(filterValue) || a.DeliveryDate.ToString().Contains(filterValue); } } page--; var cnt = _context.MaterialSupplies.Count(); return(View(new DataViewModel <MaterialSupply>() { Data = _cachedService.GetMaterialSupply().Where(filter).Skip(page * _pSize).Take(_pSize), PageCount = cnt / _pSize + (cnt % _pSize > 0 ? 1 : 0), CurrentPage = page })); }