public List <ClienteLogradouroEntity> ListarLogradouroCliente(ClienteLogradouroEntity oClienteLogradouro) { List <ClienteLogradouroEntity> returnListClienteLogradouroEntity = new List <ClienteLogradouroEntity>(); try { using (var myModel = new ContextModel.Model()) { var retorno = myModel.Query <ClienteLogradouroEntity>().ToList().Where(x => x.IDCliente == oClienteLogradouro.IDCliente); foreach (var item in retorno) { returnListClienteLogradouroEntity.Add(new ClienteLogradouroEntity() { ID = item.ID, IDCliente = item.IDCliente, IDLogradouro = item.IDLogradouro }); } } } catch (Exception ex) { throw ex; } return(returnListClienteLogradouroEntity); }
internal List <LogradouroEntity> SelecionarLogradouroPorCliente(ClienteEntity myCliente, LogradouroEntity myLogradouro) { List <LogradouroEntity> retorno = new List <LogradouroEntity>(); try { using (var myModel = new ContextModel.Model()) { retorno = myModel.Query <LogradouroEntity>().ToList().Where(x => x.CEP == myLogradouro.CEP && x.Bairro == myLogradouro.Bairro && x.Endereco == myLogradouro.Endereco).ToList(); retorno = (from item in retorno join item2 in myModel.Query <ClienteLogradouroEntity>().ToList() on item.ID equals item2.IDLogradouro where item2.IDCliente == myCliente.ID select item).ToList(); } } catch (Exception ex) { throw ex; } return(retorno); }
public List <ClienteEntity> ListarClientes(ClienteEntity oCliente) { List <ClienteEntity> returnListClienteEntity = new List <ClienteEntity>(); try { using (var myModel = new ContextModel.Model()) { returnListClienteEntity = myModel.Query <ClienteEntity>().ToList(); } } catch (Exception ex) { throw ex; } return(returnListClienteEntity); }
public List <LogradouroEntity> ListarLogradouros(LogradouroEntity oLogradouro) { List <LogradouroEntity> returnListLogradouroEntity = new List <LogradouroEntity>(); try { using (var myModel = new ContextModel.Model()) { returnListLogradouroEntity = myModel.Query <LogradouroEntity>().ToList(); } } catch (Exception ex) { throw ex; } return(returnListLogradouroEntity); }