Пример #1
0
        // GET: Fuels
        public async Task <ActionResult> Index(PageInfo pageinfo)
        {
            int    page         = pageinfo.PageNumber;
            string searchString = pageinfo.SearchString ?? "";

            transferdata            = (TransferData)Session["TransferData"];
            transferdata.FuelPage   = page; transferdata.strFuelTypeFind = searchString;
            Session["TransferData"] = transferdata;


            PagedCollections <Fuel> pagedcollection = await _fuelService.GetNumberItems(t => (t.FuelType.Contains(searchString)), page);

            pagedcollection.PageInfo.SearchString = searchString;

            return(View(pagedcollection));
        }
Пример #2
0
        public async Task <ActionResult> Index(string sortOrder, PageInfo pageinfo)
        {
            int    page          = pageinfo.PageNumber;
            string searchString  = pageinfo.SearchString ?? "";
            string nameSortParm  = String.IsNullOrEmpty(sortOrder) ? "TankType" : "";
            string name2SortParm = sortOrder == "TankMaterial" ? "TankMaterial_desc" : "TankMaterial";

            transferdata            = (TransferData)Session["TransferData"];
            transferdata.TankPage   = page; transferdata.strTankTypeFind = searchString;
            Session["TransferData"] = transferdata;

            //ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "TankType" : "";
            //ViewBag.Name2SortParm = sortOrder == "TankMaterial" ? "TankMaterial_desc" : "TankMaterial";

            PagedCollections <Tank> pagedcollection = await _tankService.GetNumberItems(t => (t.TankType.Contains(searchString)), page, sortOrder);

            pagedcollection.PageInfo.SearchString  = searchString;
            pagedcollection.PageInfo.NameSortParm  = nameSortParm;
            pagedcollection.PageInfo.Name2SortParm = name2SortParm;

            return(View(pagedcollection));
            //return View(tanks.ToList());
        }
Пример #3
0
        public async Task <ActionResult> Index(int pagesize = 10)
        {
            //Инициализация временных переменных сессии для использования разными объектами
            Session["TransferData"] = transferdata;
            int page = transferdata.OperationPage;

            ViewBag.NumberOperations = pagesize;
            //Получаем из БД  pagesize объектов Operation, при этом будут подгружаться данные из Tank и Fuel
            PagedCollections <Operation> pagedcollection = await _operationService.GetNumberItems(t => true, page, "", pagesize);

            // передаем все объекты в динамическое свойство Operations в ViewBag
            ViewBag.Operations = pagedcollection.PagedItems;
            ViewBag.PageInfo   = pagedcollection.PageInfo;
            return(View());
        }