public async Task <IActionResult> Client(string buffie, string searchString) { // Use LINQ to get list of genres. IQueryable <string> genreQuery = from m in _context.Client orderby m.ClientName select m.ClientName; var Clientbuffs = from m in _context.Client select m; if (!String.IsNullOrEmpty(searchString)) { Clientbuffs = Clientbuffs.Where(s => s.ClientName.Contains(searchString)); } if (!String.IsNullOrEmpty(buffie)) { Clientbuffs = Clientbuffs.Where(x => x.ClientName == buffie); } var buffieVM = new BuffMemberViewModel(); buffieVM.Clientgenres = new SelectList(await genreQuery.Distinct().ToListAsync()); buffieVM.Clientbuffs = await Clientbuffs.ToListAsync(); return(View(buffieVM)); }
public async Task <IActionResult> Project(string projie, string searchString) { IQueryable <string> genreQuery = from m in _context.Project orderby m.ProjectName select m.ProjectName; var Projectbuffs = from m in _context.Project select m; if (!String.IsNullOrEmpty(searchString)) { Projectbuffs = Projectbuffs.Where(s => s.ProjectName.Contains(searchString)); } if (!String.IsNullOrEmpty(projie)) { Projectbuffs = Projectbuffs.Where(x => x.ProjectName == projie); } var projieVM = new BuffMemberViewModel(); projieVM.Projectgenres = new SelectList(await genreQuery.Distinct().ToListAsync()); projieVM.Projectbuffs = await Projectbuffs.ToListAsync(); return(View(projieVM)); }
// GET: Movies public async Task <IActionResult> Index(string movieGenre, string searchString) { // Use LINQ to get list of genres. IQueryable <string> genreQuery = from m in _context.Member orderby m.LastName select m.LastName; var buffs = from m in _context.Member select m; if (!String.IsNullOrEmpty(searchString)) { buffs = buffs.Where(s => s.LastName.Contains(searchString)); } if (!String.IsNullOrEmpty(movieGenre)) { buffs = buffs.Where(x => x.LastName == movieGenre); } var movieGenreVM = new BuffMemberViewModel(); movieGenreVM.genres = new SelectList(await genreQuery.Distinct().ToListAsync()); movieGenreVM.buffs = await buffs.ToListAsync(); return(View(movieGenreVM)); }