public ActionResult Edit(string id) { UserManager manager = new UserManager(); User user = manager.findById(id); bool role = manager.hasClaim(id, ClaimTypes.Role, "admin", false); if (role) { ViewBag.AdminLockout = "Do not try to lock yourself out!"; return RedirectToAction("Index", "Administrator"); } if (user == null) { return HttpNotFound(); } return View(user); }
public ActionResult Edit(User input) { UserManager manager = new UserManager(); User user = manager.findById(input.Id); if (ModelState.IsValid) { //db.Users.Attach(userprofile); //db.Entry(userprofile).Property(x => x.Active).IsModified = true; //db.SaveChanges(); user.Active = input.Active; manager.Update(user); return RedirectToAction("Index"); } return View(user); }
public ActionResult TeacherEdit(string id) { UserManager manager = new UserManager(); User user = manager.findById(id); if (user == null) { return HttpNotFound(); } return View(user); }
public ActionResult TeacherRemove(User input) { UserManager manager = new UserManager(); User user = manager.findById(input.Id); if (ModelState.IsValid) { manager.RemoveClaim(input.Id, new Claim(ClaimTypes.Role, "teacher")); return RedirectToAction("Index"); } return View(user); }