// GET: UserProfiles/Edit/5 public ActionResult Edit(int?id, string ReturnUrl) { ViewBag.ReturnUrl = ReturnUrl; if (id == null) { id = WebSecurity.CurrentUserId; } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UserProfileFull userProfileFull = new UserProfileFull(db.UserProfiles.Find(id)); if (userProfileFull == null) { return(HttpNotFound()); } //, new[] { "" } string[] roles = rolesProvider.GetRolesForUser(userProfileFull.UserName); ViewBag.RolesSelectList = Utility.ToSelectList(rolesProvider.GetAllRoles()); if (roles.Length <= 0) { userProfileFull.Roles = new[] { "" }; } else { userProfileFull.Roles = roles; } return(View(userProfileFull)); }
public ActionResult RoleList() { SimpleRoleProvider simpleRoles = Roles.Provider as SimpleRoleProvider; var roles = simpleRoles.GetAllRoles().Select(r => new RoleModel(r)); return(View(roles)); }