public static ListaApartamentoTO ListarPorContrato(int idContrato) { _Crud = CrudService <ApartamentoCrud> .ObterInstancia(); ListaApartamentoTO retorno = new ListaApartamentoTO(); try { retorno = _Crud.Listar(); if (retorno.Valido) { retorno.Lista = retorno.Lista.Where(x => x.IdContrato == idContrato).ToList(); } } catch (Exception ex) { retorno.Valido = false; retorno.Mensagem = string.Format("Erro: {0}", ex.Message); } return(retorno); }
public static ListaApartamentoTO Listar() { _Crud = CrudService <ApartamentoCrud> .ObterInstancia(); return(_Crud.Listar()); }