public HideIfEnumValueAttribute(string variable, HideIf hideIf, params int[] states) { this.variable = variable; this.hideIfEqual = hideIf == HideIf.Equal; this.states = states; this.order = -1; }
public void Check(HideIf <TModel> condition) { DoCheck(CurrentPropertiesDictionary[condition.Field]); void DoCheck(IFormField currentField) { currentField.IsVisible = ShouldHide ( mapper.Map <TModel>(CurrentProperties.ToDictionary(p => p.Name, p => p.Value)), condition.Evaluator ) == false; } bool ShouldHide(TModel entity, Expression <Func <TModel, bool> > evaluator) => new List <TModel> { entity } .AsQueryable().All(evaluator); }