public virtual void Update(ApplicationGroup entity) { if (entity != null) { this.Context.Entry<ApplicationGroup>(entity).State = EntityState.Modified; } }
public virtual async Task DeleteAsync(ApplicationGroup group) { this.ThrowIfDisposed(); if (group == null) { throw new ArgumentNullException("group"); } this._groupStore.Delete(group); await this.Context.SaveChangesAsync(); }
public virtual void Delete(ApplicationGroup group) { this.ThrowIfDisposed(); if (group == null) { throw new ArgumentNullException("group"); } this._groupStore.Delete(group); this.Context.SaveChanges(); }
public static void SeedIdentityForEF(ApplicationDbContext context) { if ((!context.Roles.Any()) && (!context.Users.Any())) { var roleStore = new ApplicationRoleStore(context); //var roleManager = new RoleManager<ApplicationRole, int>(roleStore); var roleManager = new ApplicationRoleManager(roleStore); var role = new ApplicationRole { Name = "Admin", Description = "Super Admin User group" }; roleManager.Create(role); var userStore = new UserStore<ApplicationUser, ApplicationRole, int, ApplicationUserLogin, ApplicationUserRole, ApplicationUserClaim>(context); var userManager = new ApplicationUserManager(userStore); var user = new ApplicationUser { Email = "*****@*****.**", UserName = "******", EmailConfirmed = true }; user.FirstName = "Jack"; user.LastName = "Smith"; userManager.Create(user, "P@ssword"); var result = userManager.SetLockoutEnabled(user.Id, false); userManager.AddToRole(user.Id, "Admin"); //added group manager var groupManager = new ApplicationGroupManager(roleManager,userManager); var newGroup = new ApplicationGroup("SuperAdmins", "Full Access to All"); groupManager.CreateGroup(newGroup); groupManager.SetUserGroups(user.Id, new int[] { newGroup.Id }); groupManager.SetGroupRoles(newGroup.Id, new string[] { role.Name }); } }
public void Delete(ApplicationGroup entity) { this.DbEntitySet.Remove(entity); }
public void Create(ApplicationGroup entity) { this.DbEntitySet.Add(entity); }
public IdentityResult CreateGroup(ApplicationGroup group) { _groupStore.Create(group); return IdentityResult.Success; }
public async Task<IdentityResult> CreateGroupAsync(ApplicationGroup group) { await _groupStore.CreateAsync(group); return IdentityResult.Success; }
public IdentityResult UpdateGroup(ApplicationGroup group) { _groupStore.Update(group); foreach (var groupUser in group.ApplicationUsers) { this.RefreshUserGroupRoles(groupUser.ApplicationUserId); } return IdentityResult.Success; }
public async Task<IdentityResult> UpdateGroupAsync(ApplicationGroup group) { await _groupStore.UpdateAsync(group); foreach (var groupUser in group.ApplicationUsers) { await this.RefreshUserGroupRolesAsync(groupUser.ApplicationUserId); } return IdentityResult.Success; }