Esempio n. 1
0
        public ActionResult UserperRole(string id)
        {
            UserinRoleViewModel user = new UserinRoleViewModel();

            var    userRole = UserManager.GetRoles(id);
            string roleName = userRole.Count() == 0 ? "user" : userRole[0];

            var roleList = RoleManager.Roles.ToList();

            var userinrole = user.GetUsersinRole().FirstOrDefault(u => u.userId == id);

            userinrole.selectListRoles = roleList.Select(s => new SelectListItem()
            {
                Value    = s.Id.ToString(),
                Text     = s.Name,
                Selected = s.Name == roleName ? true : false
            });
            return(PartialView("UserRoles_PartialView", userinrole));
        }
Esempio n. 2
0
        public ActionResult AddRoleUser(string id)
        {
            UserinRoleViewModel user = new UserinRoleViewModel();


            var    userRole   = UserManager.GetRoles(id);
            var    userinrole = user.GetUsersinRole().FirstOrDefault(u => u.userId == id);
            string roleName   = userRole.Count() == 0 ? "user" : userRole[0];
            var    roleList   = RoleManager.Roles.ToList();

            userinrole.selectListRoles = roleList.Select(s => new SelectListItem()
            {
                Value    = s.Id.ToString(),
                Text     = s.Name,
                Selected = s.Name == roleName ? true : false
            });

            //userinrole.selectListPhysicians = _appointmentServices.GetAllDoctors();

            return(PartialView("_AddRoleUser", userinrole));
        }