protected override string OnCanExecute(T entity) { S state = Graph <T, S> .GetStateFunc(entity); if (!FromStates.Contains(state)) { return(OperationMessage.StateShouldBe0InsteadOf1.NiceToString().FormatWith( FromStates.CommaOr(v => ((Enum)(object)v).NiceToString()), ((Enum)(object)state).NiceToString())); } return(base.OnCanExecute(entity)); }
protected override string?OnCanDelete(T entity) { S state = Graph <T, S> .GetStateFunc(entity); if (!FromStates.Contains(state)) { return(OperationMessage.StateShouldBe0InsteadOf1.NiceToString().FormatWith( FromStates.CommaOr(v => ((Enum?)(object?)v)?.NiceToString() ?? "null"), ((Enum?)(object?)state)?.NiceToString() ?? "null")); } return(base.OnCanDelete(entity)); }
public bool IsExistingState(string state) { return(FromStates.Contains(state) || ToStates().Contains(state)); }