public async Task <IActionResult> ShowWeatherArchives( Months month, int?year, int page = 1) { int pageSize = 10; var source = _dbConnection.Weather.Select(x => x); if (month == 0 && year != null) { source = source.Where( obj => obj.Date.Year.Equals( year)); } if (month > 0 && year != null) { source = source.Where(obj => obj.Date.Year.Equals(year) && obj.Date.Month.Equals((int)month)); } return (View( await PageViewModel.CreateAsync( source.AsNoTracking(), page, pageSize, month, year))); }
// GET: Devices public async Task <IActionResult> Index(string sortOrder, string currentFilter, string searchString, int?pageNumber) { ViewData["CurrentSort"] = sortOrder; ViewData["NameSortParm"] = String.IsNullOrEmpty(sortOrder) ? "name_desc" : ""; if (searchString != null) { pageNumber = 1; } else { searchString = currentFilter; } ViewData["CurrentFilter"] = searchString; var devices = from s in _context.Devices.Include(d => d.Tire).Include(d => d.TypeFuel).Include(d => d.WinterTime) select s; switch (sortOrder) { case "name_desc": devices = devices.OrderByDescending(s => s.Namedevice); break; default: devices = devices.OrderBy(s => s.Namedevice); break; } int pageSize = 8; return(View(await PageViewModel <Device> .CreateAsync(devices.AsNoTracking(), pageNumber ?? 1, pageSize))); //var transportWorkshopCoreContext = _context.Devices.Include(d => d.Tire).Include(d => d.TypeFuel).Include(d => d.WinterTime); //return View(await transportWorkshopCoreContext.ToListAsync()); }
// GET: AutoCars public async Task <IActionResult> Index(string sortOrder, string currentFilter, string currentFilter2, string searchString2, string currentFilter3, string searchString3, string searchString, int?pageNumber) { ViewData["CurrentSort"] = sortOrder; ViewData["NameSortParm"] = String.IsNullOrEmpty(sortOrder) ? "name_desc" : ""; ViewData["MileageSortParm"] = sortOrder == "Mileage" ? "mileage_desc" : "Mileage"; if (searchString != null || searchString2 != null || searchString3 != null) { pageNumber = 1; } else { searchString = currentFilter; searchString2 = currentFilter2; searchString3 = currentFilter3; } ViewData["CurrentFilter"] = searchString; var autocars = from s in _context.AutoCars.Include(a => a.Driver).Include(a => a.NormaFuel).Include(a => a.Tire).Include(a => a.Trailer).Include(a => a.TypeAuto).Include(a => a.TypeFuel) select s; if (!String.IsNullOrEmpty(searchString)) { autocars = autocars.Where(s => s.Driver.FirsLastMidName.Contains(searchString)); } ViewData["CurrentFilter2"] = searchString2; if (!String.IsNullOrEmpty(searchString2)) { autocars = autocars.Where(s => s.TypeFuel.Fuel.Contains(searchString2)); } ViewData["CurrentFilter3"] = searchString3; if (!String.IsNullOrEmpty(searchString3)) { autocars = autocars.Where(s => s.NameAuto.Contains(searchString3)); } switch (sortOrder) { case "name_desc": autocars = autocars.OrderByDescending(s => s.NameAuto); break; case "Mileage": autocars = autocars.OrderBy(s => s.Mileage); break; case "mileage_desc": autocars = autocars.OrderByDescending(s => s.Mileage); break; default: autocars = autocars.OrderBy(s => s.NameAuto); break; } int pageSize = 5; return(View(await PageViewModel <AutoCar> .CreateAsync(autocars.AsNoTracking(), pageNumber ?? 1, pageSize))); //var transportWorkshopCoreContext = _context.AutoCars.Include(a => a.Driver).Include(a => a.NormaFuel).Include(a => a.Tire).Include(a => a.Trailer).Include(a => a.TypeAuto).Include(a => a.TypeFuel); //return View(await transportWorkshopCoreContext.ToListAsync()); }
// GET: Services public async Task <IActionResult> Index(string sortOrder, string currentFilter, string currentFilter2, string searchString, string searchString2, int?pageNumber) { ViewData["CurrentSort"] = sortOrder; ViewData["DateSortParm"] = sortOrder == "Date" ? "date_desc" : "Date"; ViewData["CostSortParm"] = sortOrder == "Cost" ? "cost_desc" : "Cost"; if (searchString != null || searchString2 != null) { pageNumber = 1; } else { searchString = currentFilter; searchString2 = currentFilter2; } ViewData["CurrentFilter"] = searchString; var services = from s in _context.Services.Include(s => s.Clients).Include(s => s.Employee) select s; if (!String.IsNullOrEmpty(searchString)) { services = services.Where(c => c.Cost < Convert.ToInt32(searchString)); } ViewData["CurrentFilter2"] = searchString2; if (!String.IsNullOrEmpty(searchString2)) { services = services.Where(c => c.Cost > Convert.ToInt32(searchString2)); } switch (sortOrder) { case "Date": services = services.OrderBy(s => s.Date); break; case "date_desc": services = services.OrderByDescending(s => s.Date); break; case "Cost": services = services.OrderBy(s => s.Cost); break; case "cost_desc": services = services.OrderByDescending(s => s.Cost); break; } int pageSize = 10; return(View(await PageViewModel <Service> .CreateAsync(services.AsNoTracking(), pageNumber ?? 1, pageSize))); }
// GET: NormaFuels public async Task <IActionResult> Index(string sortOrder, string currentFilter, string searchString, int?pageNumber) { ViewData["CurrentSort"] = sortOrder; ViewData["LinearSortParm"] = String.IsNullOrEmpty(sortOrder) ? "linear_desc" : ""; ViewData["SummerSortParm"] = sortOrder == "Summer" ? "summer_desc" : "Summer"; ViewData["WinterSortParm"] = sortOrder == "Winter" ? "winter_desc" : "Winter"; if (searchString != null) { pageNumber = 1; } else { searchString = currentFilter; } ViewData["CurrentFilter"] = searchString; var normafuels = from s in _context.NormaFuels select s; switch (sortOrder) { case "linear_desc": normafuels = normafuels.OrderByDescending(s => s.Linear); break; case "Summer": normafuels = normafuels.OrderBy(s => s.Summer); break; case "summer_desc": normafuels = normafuels.OrderByDescending(s => s.Summer); break; case "Winter": normafuels = normafuels.OrderBy(s => s.Winter); break; case "winter_desc": normafuels = normafuels.OrderByDescending(s => s.Winter); break; default: normafuels = normafuels.OrderBy(s => s.Linear); break; } int pageSize = 8; return(View(await PageViewModel <NormaFuel> .CreateAsync(normafuels.AsNoTracking(), pageNumber ?? 1, pageSize))); //return View(await _context.NormaFuels.ToListAsync()); }
// GET: Balances public async Task <IActionResult> Index(string sortOrder, string currentFilter, string searchString, int?pageNumber) { ViewData["CurrentSort"] = sortOrder; ViewData["DateSortParm"] = String.IsNullOrEmpty(sortOrder) ? "date_desc" : ""; ViewData["LeftoverSortParm"] = sortOrder == "Leftover" ? "leftover_desc" : "Leftover"; if (searchString != null) { pageNumber = 1; } else { searchString = currentFilter; } ViewData["CurrentFilter"] = searchString; var balances = from s in _context.Balances.Include(b => b.AutoCar) select s; if (!String.IsNullOrEmpty(searchString)) { balances = balances.Where(s => s.AutoCar.NameAuto.Contains(searchString)); } switch (sortOrder) { case "date_desc": balances = balances.OrderByDescending(s => s.Date); break; case "Leftover": balances = balances.OrderBy(s => s.Leftovers); break; case "leftover_desc": balances = balances.OrderByDescending(s => s.Leftovers); break; default: balances = balances.OrderBy(s => s.Date); break; } int pageSize = 5; return(View(await PageViewModel <Balance> .CreateAsync(balances.AsNoTracking(), pageNumber ?? 1, pageSize))); //var transportWorkshopCoreContext = _context.Balances.Include(b => b.AutoCar); //return View(await transportWorkshopCoreContext.ToListAsync()); }
// GET: Drivers public async Task <IActionResult> Index(string sortOrder, string currentFilter, string searchString, int?pageNumber) { ViewData["CurrentSort"] = sortOrder; ViewData["NameSortParm"] = String.IsNullOrEmpty(sortOrder) ? "name_desc" : ""; ViewData["CategorySortParm"] = sortOrder == "Category" ? "category_desc" : "Category"; if (searchString != null) { pageNumber = 1; } else { searchString = currentFilter; } ViewData["CurrentFilter"] = searchString; var drivers = from s in _context.Drivers//доделать select s; if (!String.IsNullOrEmpty(searchString)) { drivers = drivers.Where(s => s.FirsLastMidName.Contains(searchString)); } switch (sortOrder) { case "name_desc": drivers = drivers.OrderByDescending(s => s.FirsLastMidName); break; case "Category": drivers = drivers.OrderBy(s => s.Category); break; case "category_desc": drivers = drivers.OrderByDescending(s => s.Category); break; default: drivers = drivers.OrderBy(s => s.FirsLastMidName); break; } int pageSize = 8; return(View(await PageViewModel <Driver> .CreateAsync(drivers.AsNoTracking(), pageNumber ?? 1, pageSize))); //return View(await _context.Drivers.ToListAsync()); }
// GET: Clients public async Task <IActionResult> Index(string sortOrder, string currentFilter, string searchString, int?pageNumber) { ViewData["CurrentSort"] = sortOrder; ViewData["NameSortParm"] = String.IsNullOrEmpty(sortOrder) ? "name_desc" : ""; ViewData["DateSortParm"] = sortOrder == "Date" ? "date_desc" : "Date"; if (searchString != null) { pageNumber = 1; } else { searchString = currentFilter; } ViewData["CurrentFilter"] = searchString; var clients = from s in _context.Clients.Include(c => c.Nationalitie).Include(c => c.Relation).Include(c => c.ZodiacSign) select s; if (!String.IsNullOrEmpty(searchString)) { clients = clients.Where(s => s.ZodiacSign.Name.Contains(searchString)); } switch (sortOrder) { case "name_desc": clients = clients.OrderByDescending(s => s.FirsLastMidName); break; case "Date": clients = clients.OrderBy(s => s.DateofBirth); break; case "date_desc": clients = clients.OrderByDescending(s => s.DateofBirth); break; default: clients = clients.OrderBy(s => s.FirsLastMidName); break; } int pageSize = 5; return(View(await PageViewModel <Client> .CreateAsync(clients.AsNoTracking(), pageNumber ?? 1, pageSize))); }
// GET: Tires public async Task <IActionResult> Index(string sortOrder, string currentFilter, string searchString, int?pageNumber) { ViewData["CurrentSort"] = sortOrder; ViewData["DateSortParm"] = String.IsNullOrEmpty(sortOrder) ? "date_desc" : ""; ViewData["RunSortParm"] = sortOrder == "Run" ? "run_desc" : "Run"; if (searchString != null) { pageNumber = 1; } else { searchString = currentFilter; } ViewData["CurrentFilter"] = searchString; var tires = from s in _context.Tires select s; switch (sortOrder) { case "date_desc": tires = tires.OrderByDescending(s => s.Date); break; case "Run": tires = tires.OrderBy(s => s.RunStart); break; case "run_desc": tires = tires.OrderByDescending(s => s.RunStart); break; default: tires = tires.OrderBy(s => s.Date); break; } int pageSize = 8; return(View(await PageViewModel <Tire> .CreateAsync(tires.AsNoTracking(), pageNumber ?? 1, pageSize))); //return View(await _context.Tires.ToListAsync()); }
// GET: Employees public async Task <IActionResult> Index(string sortOrder, string currentFilter, string searchString, int?pageNumber) { ViewData["CurrentSort"] = sortOrder; ViewData["NameSortParm"] = String.IsNullOrEmpty(sortOrder) ? "name_desc" : ""; if (searchString != null) { pageNumber = 1; } else { searchString = currentFilter; } ViewData["CurrentFilter"] = searchString; var employees = from s in _context.Employees.Include(e => e.Position) select s; if (!String.IsNullOrEmpty(searchString)) { employees = employees.Where(s => s.Position.NamePosition.Contains(searchString)); } switch (sortOrder) { case "name_desc": employees = employees.OrderByDescending(s => s.FirsLastMidName); break; default: employees = employees.OrderBy(s => s.FirsLastMidName); break; } int pageSize = 5; return(View(await PageViewModel <Employee> .CreateAsync(employees.AsNoTracking(), pageNumber ?? 1, pageSize))); }
// GET: Movies public async Task <IActionResult> Index(int?pageNumber) { IQueryable <MovieModel> movies = _context.Movies.Include(m => m.Author); return(View(await PageViewModel <MovieModel> .CreateAsync(movies, pageNumber ?? 1, pageSize))); }