Ejemplo n.º 1
0
        public async Task <IActionResult> ExecuteAsync(CancellationToken cancellationToken)
        {
            ICollection <GlobalToggle> toggles = await _globalToggleRepository.GetAll(cancellationToken);

            if (toggles == null)
            {
                return(new NotFoundResult());
            }
            return(new OkObjectResult(_mapper.Map <ICollection <GlobalToggle>, List <GlobalToggleVM> >(toggles)));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> ExecuteAsync(string serviceId, string version, CancellationToken cancellationToken)
        {
            List <GlobalToggle> globalToggles = await _globalToggleRepository.GetAll(cancellationToken);

            List <ServiceToggle> serviceToggles = await _serviceToggleRepository.GetAllByServiceId(serviceId, cancellationToken);

            if (globalToggles is null || serviceToggles is null)
            {
                return(new NotFoundResult());
            }
            List <Toggle> resultToggles = _ruleEvaluator.Eval(serviceId, version, globalToggles, serviceToggles);

            return(new OkObjectResult(_mapper.Map <ICollection <Toggle>, List <ToggleVM> >(resultToggles)));
        }