Man Down

Man Down

  • NA
  • 48
  • 3.4k

How to not list users which have Admin role - Asp.Net MVC 5

Jan 31 2018 3:04 AM
In my table i have two columns Email_ID & Role , for example (Email_ID : [email protected] & Role : Admin) and what I'am trying to do is avoid or not showing the users or those have Role as Admin , but the code i have now is showing all users. 
 
 My Code look like this : 
  1. public ActionResult AllEmails(string searching, int? pageNumber)   
  2.        {  
  3.   
  4. return View(db.PX.Where(x => x.Email_ID.Contains(searching) || 
  5. searching == null).ToList().OrderBy(t => t.Role).ToPagedList(pageNumber ?? 1, 5));  
  6.   
  7.              
  8.   
  9.    }  
 
 

Answers (5)