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 UserView(User user) { UserManager manager = new UserManager(); Users = user; if (manager.hasClaim(user.UserName, "teacher")) { userRole = "Teacher"; } else if (manager.hasClaim(user.UserName, "admin")) { userRole = "Admin"; } else { userRole = "Student"; } }
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); }