/// <summary> /// designed to be used with seed method /// </summary> /// <param name="roleManger"></param> /// <param name="userManager"></param> public ApplicationGroupManager(ApplicationRoleManager roleManger, ApplicationUserManager userManager) { _db = new ApplicationDbContext(); _groupStore = new ApplicationGroupStore(_db); _userManager = userManager; _roleManager = roleManger; }
public ApplicationGroupManager() { var context = HttpContext.Current; if (context == null) { _db = new ApplicationDbContext(); _userManager = new ApplicationUserManager(new ApplicationUserStore()); _roleManager = new ApplicationRoleManager(new ApplicationRoleStore()); } else { _db = HttpContext.Current.GetOwinContext().Get<ApplicationDbContext>(); _userManager = HttpContext.Current.GetOwinContext().GetUserManager<ApplicationUserManager>(); _roleManager = HttpContext.Current.GetOwinContext().Get<ApplicationRoleManager>(); } _groupStore = new ApplicationGroupStore(_db); }