Ejemplo n.º 1
0
        public async Task Process(TRequest message, TResponse response)
        {
            var userId = (await accountRepository.Find(message.AccountId)).UserId;

            (await rulesEvaluator
             .GetSuitableRules(message.Id, userId))
            .ForEach(r => actionFactory.Create(r, message.Id));
        }
Ejemplo n.º 2
0
        public static CommandBindingCollection FromCollection(
            IEnumerable <CommandBinding> bindings,
            IActionFactory actionFactory)
        {
            var dict = new Dictionary <string, IAction>();

            foreach (var binding in bindings)
            {
                dict[binding.Command] = actionFactory.Create(binding.Action);
            }

            return(new CommandBindingCollection(dict));
        }
        public IResponse Do()
        {
            ConditionalGetFingerprint serverFingerprint = GetServerFingerprint();
            ConditionalGetFingerprint clientFingerprint = fingerprintFactory.BuildFromRequest(request);

            if (serverFingerprint.Equals(clientFingerprint))
            {
                return(new NotModifiedResponse(serverFingerprint));
            }

            IAction   action   = actionFactory.Create(request);
            IResponse response = action.Execute(request);

            response.ServerFingerprint = serverFingerprint;
            return(response);
        }
Ejemplo n.º 4
0
        public IResponse Do()
        {
            IAction action = actionFactory.Create(request);

            return(action.Execute(request));
        }