Sunday, 15 March 2015

c# - Get Specific User Role's aspnet users -


I am using a membership provider and I have to get some users in some user roles. In my scenario this "supervisor"

But here I am having difficulty finding a list of Usurrol's user list (supervisor).

Enter image details here

My view

  @ html.DropDownList ("drpsup", ViewBag.SupervisorList as System.Web  

My Model

< Public string user name {get};}}

My controller

  Public Functional Interviewer Management () {User Business _ub = New UserBusiness (); Var sRole = _ub.GetSupervisors (); ViewBag.SupervisorList = new selection list (supList, "UserId", "UserName", 0);  

My Business Class

  Public ILIT 
  • Supervisor> GetSupervisors () {var AllUsr = iuserrepository.GetList (x => x.UserId! = Null); Var xRole = irolerepository.GetSingle (x = & gt; ; X.RoleName.Equals ("Supervisor"); Var yRole = iusersinrolerepository.GetList (x = & gt; X.RoleId.Equals (xRole.RoleId)); // var suprole = iuserrepository.GetList (x => x.UserId! = Null). Select (x = & gt; x.UserId.Equals (yRole.Where (d = & gt; d.)) ToList (); Return Superrole;} Return View ();}
  • In my business class, I just comment on super superol .... I know a little bit to solve the problem. But o do not have any idea of ​​what to do.


    No comments:

    Post a Comment