Esempio n. 1
0
        public async Task <IActionResult> Get([FromQuery] ClienteQueryModel query)
        {
            if (!ModelState.IsValid)
            {
                return(Response(query));
            }

            var clientes = await _clienteService.ObterListaPaginados(query);

            if (!clientes.Any() && IsValidOperation())
            {
                return(NoContent());
            }

            return(Response(clientes));
        }
        public async Task <IEnumerable <ClienteDto> > ObterListaPaginados(ClienteQueryModel queryModel)
        {
            var command = _mapper.Map <ObterClientesQuery>(queryModel);

            return(await _mediator.Send(command));
        }