private void button1_Click(object sender, EventArgs e) { var db = new DadosModelo(); var Navio = db.Set <navio>(); Navio.Add(new navio { idNavio = 01, vesselName = vesselName.Text, flag = flag.Text, callSign = callSign.Text, imo = Convert.ToInt32(imo.Text), loa = Convert.ToInt32(loa.Text), nrt = Convert.ToInt32(nrt.Text), grt = Convert.ToInt32(grt.Text), dwt = Convert.ToInt32(dwt.Text), builtYear = Convert.ToInt16(built.Text) }); db.SaveChanges(); MessageBox.Show("Navio cadastrado com sucesso"); this.Close(); }
protected void bindCombo() { DadosModelo db = new DadosModelo(); var item = db.navio.ToList(); ListVessel.DataSource = item; ListVessel.DisplayMember = "vesselName"; }
public bool entrar(string login, string senha) { var db = new DadosModelo(); var usuario = db.user.FirstOrDefault(u => u.nome == login && u.senha == senha); if (usuario != null) { return(true); } else { return(false); } }