public void enableAccount(ApplicationUser entity) { var userManager = new MujZavod.Data.Identity.ApplicationUserManager( new Microsoft.AspNet.Identity.EntityFramework.UserStore <MujZavod.Data.Identity.ApplicationUser>(Context)); userManager.SetLockoutEnabled(entity.Id, false); }
public void Create(ApplicationUser entity, string[] roles) { var userManager = new MujZavod.Data.Identity.ApplicationUserManager( new Microsoft.AspNet.Identity.EntityFramework.UserStore <MujZavod.Data.Identity.ApplicationUser>(Context)); var result = userManager.Create(entity); result = userManager.SetLockoutEnabled(entity.Id, false); var rolesForUser = userManager.GetRoles(entity.Id); foreach (string role in roles) { if (!rolesForUser.Contains(role)) { var res = userManager.AddToRole(entity.Id, role); } } }