Пример #1
0
            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));
            }
Пример #2
0
            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));
            }