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)); }
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)); }