Ejemplo n.º 1
0
        // 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));
        }
Ejemplo n.º 2
0
        // GET: UserProfiles/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UserProfileFull userProfileFull = new UserProfileFull(db.UserProfiles.Find(id));

            if (userProfileFull == null)
            {
                return(HttpNotFound());
            }
            userProfileFull.Roles = rolesProvider.GetRolesForUser(userProfileFull.UserName);
            return(View(userProfileFull));
        }