// GET: api/PessoaJuridica/5 public HttpResponseMessage Get(int id) { JuridicaCrud crud = new JuridicaCrud(); Juridica juridica = new Juridica(); juridica.RazaoSocial = string.Empty; juridica.IdPessoa = id; try { Juridica cliente = crud.ConsultarNomeOrId(juridica).First(); if (cliente.RazaoSocial != null) { return(Request.CreateResponse(HttpStatusCode.OK, cliente)); } else { return(Request.CreateResponse(HttpStatusCode.NotFound)); } } catch (Exception) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } }
private void PesquisarJuridica() { Juridica juridica = new Juridica(); juridica.RazaoSocial = txtPesquisar.Text; JuridicaCrud juridicaCrud = new JuridicaCrud(); List <Juridica> list = juridicaCrud.ConsultarNomeOrId(juridica); dgFisica.DataSource = null; dgFisica.DataSource = list; dgFisica.Refresh(); dgFisica.Update(); }
public static void CarregarTodosClienteJuridica(DataGridView dg) { List <Juridica> list = new List <Juridica>(); Juridica juridica = new Juridica(); JuridicaCrud juridicaCrud = new JuridicaCrud(); juridica.RazaoSocial = ""; list = juridicaCrud.ConsultarNomeOrId(juridica); dg.AutoGenerateColumns = false; dg.DataSource = null; dg.DataSource = list; dg.Refresh(); dg.Update(); }