public static void RegisterAdmin() { using (var context = new CmsContext()) using (var userStore = new UserStore<CmsUser>(context)) using (var userManager = new UserManager<CmsUser>(userStore)) { var user = userStore.FindByNameAsync("admin").Result; if (user == null) { var adminUser = new CmsUser() { UserName = "******", Email = "*****@*****.**", Displayname = "Administrator" }; userManager.Create(adminUser, "Passw0rd1234"); } } }
public void Update(CmsUser user) { var result = _manager.UpdateAsync(user).Result; }
public void Delete(CmsUser user) { var result = _manager.DeleteAsync(user).Result; }
public void Create(CmsUser user, string password) { var result = _manager.CreateAsync(user, password).Result; }