public ActionResult Index() { SysAdminViewModel vm = new SysAdminViewModel(); vm.Tables = db.Tables.Where(t => t.Position.Name == "SysAdmin").ToList(); ViewData["db"] = "Default"; return(View(vm)); }
public ActionResult Index(string table) { SysAdminViewModel vm = new SysAdminViewModel(); ViewData["db"] = table; vm.ITWorkApplications = db.ITWorkApplications.Include(p => p.Employee).ToList(); vm.Tables = db.Tables.Where(t => t.Position.Name == "SysAdmin").ToList(); return(View(vm)); }
// GET: SysAdmin public ActionResult Index(int?Org, int?Prcs, int?Act) { SysAdminViewModel SysadminObj = new SysAdminViewModel(); SysadminObj.OrgArray = DMLObj.GetOrgList(Org); SysadminObj.ProcessArray = DMLObj.GetProcessList(Prcs); SysadminObj.ProcessTypeArray = DMLObj.GetAllProcessTypes(); SysadminObj.ActivityTypeArray = DMLObj.GetAllActivityTypes(); SysadminObj.ActivityItemTypeArray = DMLObj.GetAllActivityItemTypes(); SysadminObj.UserTypeArray = DMLObj.GetUserTypeList(); SysadminObj.AccessArray = DMLObj.GetAccessList(); SysadminObj.QualityIndexArray = DMLObj.GetQualityIndexList(); SysadminObj.CurrentOrgId = Org; SysadminObj.CurrentOrgParentId = DMLObj.GetParentOrgId(Org); SysadminObj.CurrentProcessId = Prcs; SysadminObj.CurrentActId = Act; return(View(SysadminObj)); }
public async Task <IActionResult> Index(string searchedValue, string searchInColumn, SortState sortOrder = SortState.NameAsc) { IQueryable <Apartment> apartments = null; if (searchedValue != null && searchInColumn != null) { switch (searchInColumn) { case ("Apartment №"): apartments = _dbContext.Apartments.Where(x => x.Name.ToString() == searchedValue); break; case ("NumberOfRooms"): apartments = _dbContext.Apartments.Where(x => x.NumberOfRooms.ToString() == searchedValue); break; case ("MaxTenants"): apartments = _dbContext.Apartments.Where(x => x.MaxTenants.ToString() == searchedValue); break; case ("PricePerHour"): apartments = _dbContext.Apartments.Where(x => x.PricePerHour.ToString() == searchedValue); break; } } else { apartments = _dbContext.Apartments.Select(x => x); } switch (sortOrder) { case SortState.NameDesc: apartments = apartments.OrderByDescending(x => x.Name); break; case SortState.ApartmentTypeAsc: apartments = apartments.OrderBy(x => x.ApartmentType); break; case SortState.ApartmentTypeDesc: apartments = apartments.OrderByDescending(x => x.ApartmentType); break; case SortState.FreeAsc: apartments = apartments.OrderBy(x => x.Free); break; case SortState.FreeDesc: apartments = apartments.OrderByDescending(x => x.Free); break; case SortState.NumberOfRoomsAsc: apartments = apartments.OrderBy(x => x.NumberOfRooms); break; case SortState.NumberOfRoomsDesc: apartments = apartments.OrderByDescending(x => x.NumberOfRooms); break; case SortState.PricePerHourAsc: apartments = apartments.OrderBy(x => x.PricePerHour); break; case SortState.PricePerHourDesc: apartments = apartments.OrderByDescending(x => x.PricePerHour); break; case SortState.MaxTenantsAsc: apartments = apartments.OrderBy(x => x.MaxTenants); break; case SortState.MaxTenantsDesc: apartments = apartments.OrderByDescending(x => x.MaxTenants); break; default: apartments = apartments.OrderBy(x => x.Name); break; } SysAdminViewModel sysViewModel = new SysAdminViewModel() { //Определяем не кэшированные данные для вывода в модели представление Apartments = await apartments.AsNoTracking().ToListAsync(), SortViewModel = new SortViewModel(sortOrder), FilterViewModel = new FilterViewModel(searchedValue, searchInColumn) }; return(View(sysViewModel)); }