示例#1
0
 public IActionResult Index(string searchBy, string search)
 {
     if (search != null)
     {
         if (searchBy == "Realname")
         {
             return(View(_computerRepository.Names().Where(p => p.Realname.Contains((search), StringComparison.CurrentCultureIgnoreCase)).ToList()));
         }
         else
         {
             return(View(_computerRepository.Names().Where(p => p.Firstname.Contains((search), StringComparison.CurrentCultureIgnoreCase)).ToList()));
         }
     }
     else
     {
         return(View(_computerRepository.Names().ToList()));
     }
 }