コード例 #1
0
        public async Task <ActionResult> Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ApplicationUser user = await userManager.FindByIdAsync(id);

            if (user == null)
            {
                return(HttpNotFound());
            }
            UserViewModel userViewModel = await UserViewModel.CreateAsync(user, roleManager);

            return(View(userViewModel));
        }
コード例 #2
0
        public async Task <ActionResult> Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ApplicationUser user = await userManager.FindByIdAsync(id);

            if (user == null)
            {
                return(HttpNotFound());
            }
            UserViewModel model = await UserViewModel.CreateAsync(user, roleManager);

            ViewBag.dropdownlist = new SelectList(db.Roles.Where(role => role.Name != "admin").OrderBy(role => role.Name), "Id", "Name", model.RoleId);
            return(View(model));
        }