public static ListaDependenteTO ListarPorMorador(int idMorador) { _Crud = CrudService <DependenteCrud> .ObterInstancia(); ListaDependenteTO retorno = new ListaDependenteTO(); try { retorno = _Crud.Listar(); if (retorno.Valido) { retorno.Lista = retorno.Lista.Where(x => x.IdMorador == idMorador).ToList(); } } catch (Exception ex) { retorno.Valido = false; retorno.Mensagem = string.Format("Erro: {0}", ex.Message); } return(retorno); }
public static ListaDependenteTO PesquisarPorNome(string nomeDependente) { _Crud = CrudService <DependenteCrud> .ObterInstancia(); ListaDependenteTO retorno = new ListaDependenteTO(); try { retorno = _Crud.Listar(); if (retorno.Valido) { retorno.Lista = retorno.Lista.Where(x => x.Nome.Contains(nomeDependente)).ToList(); } } catch (Exception ex) { retorno.Valido = false; retorno.Mensagem = string.Format("Erro: {0}", ex.Message); } return(retorno); }
public static ListaDependenteTO Listar() { _Crud = CrudService <DependenteCrud> .ObterInstancia(); return(_Crud.Listar()); }