Rock.Model.WorkflowTriggerService.Get C# (CSharp) Method

Get() public method

Returns a queryable collection of the Rock.Model.WorkflowTrigger by Rock.Model.EntityType name and Rock.Model.WorkflowTriggerType
public Get ( string entityTypeName, WorkflowTriggerType triggerType ) : IQueryable
entityTypeName string A representing the name of the to filter by.
triggerType WorkflowTriggerType The to filter by.
return IQueryable
        public IQueryable<WorkflowTrigger> Get( string entityTypeName, WorkflowTriggerType triggerType )
        {
            return Queryable()
                .Where( t =>
                    t.EntityType.Name == entityTypeName &&
                    t.WorkflowTriggerType == triggerType );
        }

Usage Example

        /// <summary>
        /// Handles the Delete event of the gWorkflowTrigger control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RowEventArgs" /> instance containing the event data.</param>
        protected void gWorkflowTrigger_Delete( object sender, RowEventArgs e )
        {
            var rockContext = new RockContext();
            WorkflowTriggerService WorkflowTriggerService = new WorkflowTriggerService( rockContext );
            WorkflowTrigger WorkflowTrigger = WorkflowTriggerService.Get( (int)e.RowKeyValue );

            if ( WorkflowTrigger != null )
            {
                string errorMessage;
                if ( !WorkflowTriggerService.CanDelete( WorkflowTrigger, out errorMessage ) )
                {
                    mdGridWarning.Show( errorMessage, ModalAlertType.Information );
                    return;
                }

                WorkflowTriggerService.Delete( WorkflowTrigger );
                rockContext.SaveChanges();
            }

            BindGrid();
        }
All Usage Examples Of Rock.Model.WorkflowTriggerService::Get
WorkflowTriggerService