Example #1
0
        public StateCanExecuteResponse StateCanExecutes(StateCanExecuteRequest request)
        {
            var types = request.lites.Select(a => a.EntityType).ToHashSet();

            var operationSymbols = request.operationKeys
                                   .Select(operationKey => types.Select(t => BaseOperationRequest.ParseOperationAssert(operationKey, t)).Distinct().SingleEx())
                                   .ToList();

            var result = OperationLogic.GetContextualCanExecute(request.lites, operationSymbols);

            return(new StateCanExecuteResponse {
                canExecutes = result.SelectDictionary(a => a.Key, v => v)
            });
        }
Example #2
0
        public StateCanExecuteResponse StateCanExecutes([Required, FromBody] StateCanExecuteRequest request)
        {
            var types = request.lites.Select(a => a.EntityType).ToHashSet();

            var operationSymbols = request.operationKeys
                                   .Select(operationKey => types.Select(t => BaseOperationRequest.ParseOperationAssert(operationKey, t)).Distinct().SingleEx())
                                   .ToList();

            var result      = OperationLogic.GetContextualCanExecute(request.lites, operationSymbols) !;
            var anyReadonly = AnyReadonly.GetInvocationListTyped().Any(f => f(request.lites));

            return(new StateCanExecuteResponse(result.SelectDictionary(a => a.Key, v => v))
            {
                anyReadonly = anyReadonly
            });
        }