コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: ViewModels.cs プロジェクト: OzzieSoft/SrPrjGrp2
 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";
     }
 }
コード例 #3
0
 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);
 }