public async Task <List <Cliente> > GetClienteFilter(FilterCliente filterCliente)
        {
            var response = await httpService.Post <FilterCliente, List <Cliente> >($"{url}/filter", filterCliente);

            if (!response.Success)
            {
                throw new ApplicationException(await response.GetBody());
            }
            return(response.Response);
        }
Exemple #2
0
        public async Task <ActionResult <List <Cliente> > > Filter(FilterCliente filterCliente)
        {
            var cliente = from m in _db.Cliente.Include(v => v.Telefone)
                          select m;

            if (!string.IsNullOrEmpty(filterCliente.Nome))
            {
                cliente = cliente.Where(s => s.Nome.Contains(filterCliente.Nome));
            }

            if (!string.IsNullOrEmpty(filterCliente.Cpf))
            {
                cliente = cliente.Where(s => s.Cpf == filterCliente.Cpf);
            }

            return(await cliente.ToListAsync());
        }