protected void gOAuthScopesDelete_Click(object sender, Rock.Web.UI.Controls.RowEventArgs e) { ScopeService scopeService = new ScopeService(OAuthContext); scopeService.Delete(scopeService.Get(e.RowKeyId)); OAuthContext.SaveChanges(); OAuthContext = new OAuthContext(); gOAuthScopes_Bind(sender, e); }
protected void gOAuthScopes_RowSelected(object sender, Rock.Web.UI.Controls.RowEventArgs e) { ScopeService scopeService = new ScopeService(OAuthContext); Scope scope = scopeService.Get(e.RowKeyId); hfScopeId.Value = scope.Id.ToString(); tbIdentifier.Text = scope.Identifier; tbDescription.Text = scope.Description; cbScopeActive.Checked = scope.Active; gOAuthScopeEdit.Show(); }
protected void gOAuthScopeEdit_SaveClick(object sender, EventArgs e) { ScopeService scopeService = new ScopeService(OAuthContext); Scope scope = null; if (hfScopeId.Value.AsIntegerOrNull().HasValue) { scope = scopeService.Get(hfScopeId.Value.AsInteger()); } else { scope = new Scope(); scopeService.Add(scope); } scope.Identifier = tbIdentifier.Text; scope.Description = tbDescription.Text; scope.Active = cbScopeActive.Checked; OAuthContext.SaveChanges(); OAuthContext = new OAuthContext(); gOAuthScopes_Bind(sender, e); gOAuthScopeEdit.Hide(); }