public virtual ActionResult DeleteConfirmed(string id)
 {
     var role = _db.Roles.First(r => r.Name == id);
     var idManager = new IdentityManager();
     idManager.DeleteRole(role.Id);
     return RedirectToAction("Index");
 }
 public virtual ActionResult DeleteConfirmed(int id)
 {
     Group group = db.Groups.Find(id);
     var idManager = new IdentityManager();
     idManager.DeleteGroup(id);
     return RedirectToAction("Index");
 }
        public virtual ActionResult Create([Bind(Include = 
            "RoleName,Description")]RoleViewModel model)
        {
            string message = "That role name has already been used";
            if (ModelState.IsValid)
            {
                var role = new ApplicationRole(model.RoleName, model.Description);
                var idManager = new IdentityManager();

                if(idManager.RoleExists(model.RoleName))
                {
                    return View(message);
                }
                else
                {
                    idManager.CreateRole(model.RoleName, model.Description);
                    return RedirectToAction("Index", "Account");
                }
            }
            return View();
        }
        public virtual ActionResult GroupRoles(SelectGroupRolesViewModel model)
        {
            if (ModelState.IsValid)
            {
                var idManager = new IdentityManager();
                var Db = new ApplicationDbContext();
                var group = Db.Groups.Find(model.GroupId);
                idManager.ClearGroupRoles(model.GroupId);

                // Add each selected role to this group:
                foreach (var role in model.Roles)
                {
                    if (role.Selected)
                    {
                        idManager.AddRoleToGroup(group.Id, role.RoleName);
                    }
                }
                return RedirectToAction("index");
            }
            return View();
        }