//for Permission drp public void GetAllPermissionForDrp() { PermissionRoleBL bL = new PermissionRoleBL(); List <PermissionRolePOCO> pocoList = new List <PermissionRolePOCO>(); pocoList = bL.GetAllPermissionForDrp(/*int.Parse(Session["VesselID"].ToString())*/); List <PermissionRolePOCO> itmasterList = new List <PermissionRolePOCO>(); foreach (PermissionRolePOCO up in pocoList) { PermissionRolePOCO unt = new PermissionRolePOCO(); unt.PermissionId = up.PermissionId; unt.PermissionName = up.PermissionName; itmasterList.Add(unt); } ViewBag.Permissions = itmasterList.Select(x => new SelectListItem() { Text = x.PermissionName, Value = x.PermissionId.ToString() }); }
//for Role drp public PermissionRolePOCO GetAllRolesForDrp() { PermissionRoleBL bL = new PermissionRoleBL(); List <PermissionRolePOCO> pocoList = new List <PermissionRolePOCO>(); pocoList = bL.GetAllRolesForDrp(); PermissionRolePOCO pOCO = new PermissionRolePOCO(); var list = new List <KeyValuePair <string, string> >(); foreach (PermissionRolePOCO up in pocoList) { PermissionRolePOCO unt = new PermissionRolePOCO(); //unt.GroupId = up.GroupId; //unt.GroupName = up.GroupName; list.Add(new KeyValuePair <string, string>(up.RoleId.ToString(), up.RoleName)); //itmasterList.Add(unt); } pOCO.Roles = list; //ViewBag.Groups = itmasterList.Select(x => // new SelectListItem() // { // Text = x.GroupName, // Value = x.GroupId.ToString() // }); return(pOCO); }
public ActionResult Index() { PermissionRolePOCO poco = new PermissionRolePOCO(); poco = GetAllRolesForDrp(); GetAllPermissionForDrp(); //GetAllGroupsForDrp(); return(View(poco)); }