public IList <ConsumerDto> GetConsumers([FromQuery] string[] consumerNames) { EnsureAdmin(); if (consumerNames.Length == 1) { var consumer = _consumerService.GetConsumerByName(consumerNames.FirstOrDefault()) ?.ToDto(); return(consumer == null ? new List <ConsumerDto>() : new List <ConsumerDto>() { consumer }); } if (!consumerNames.Any()) { return(_consumerService.GetAllConsumers().Select(x => x.ToDto()).ToList()); } return(_consumerService.GetAllConsumers().Where(x => consumerNames.Contains(x.Name)) .Select(x => x.ToDto()) .ToList()); }