protected void lbDeleteNote_Click( object sender, EventArgs e )
{
var rockPage = this.Page as RockPage;
if ( rockPage != null )
{
var currentPerson = rockPage.CurrentPerson;
var rockContext = new RockContext();
var service = new NoteService( rockContext );
Note note = null;
if ( NoteId.HasValue )
{
note = service.Get( NoteId.Value );
if ( note != null && note.NoteType.UserSelectable && note.IsAuthorized( Authorization.EDIT, currentPerson ) )
{
service.Delete( note );
rockContext.SaveChanges();
}
}
if ( DeleteButtonClick != null )
{
DeleteButtonClick( this, new NoteEventArgs( NoteId ) );
}
}
}