private async void btnSave_Click(object sender, EventArgs e) { Model.Autobus a = new Model.Autobus() { NazivAutobusa = txtVozilo.Text, Klasa = txtKlasa.Text, Status = cbStatus.Checked, BrojSjedista = int.Parse(txtBr.Text) }; var idOD = cmbVoz.SelectedValue; if (int.TryParse(idOD.ToString(), out int id)) { a.VozacId = id; } Model.Vozaci v = await _vozac.GetById <Model.Vozaci>(a.VozacId); v.Status = true; await _vozac.Update <Model.Vozaci>(a.VozacId, v); await _autobus.Insert <Model.Autobus>(a); MessageBox.Show("Operacija uspješno izvršena!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); frmRedVoznje frm = new frmRedVoznje(_id); frm.Show(); this.Close(); }
private async void unosRedaVožnjeToolStripMenuItem_Click(object sender, EventArgs e) { int id = await getId(_korIme); frmRedVoznje frm = new frmRedVoznje(id); frm.MdiParent = this; frm.Show(); }
private async void button1_Click(object sender, EventArgs e) { Model.Grad req = new Model.Grad { NazivGrada = txtNaziv.Text }; var idDr = cmbDrzava.SelectedValue; if (int.TryParse(idDr.ToString(), out int id)) { req.DrzavaId = id; } await _grad.Insert <Model.Grad>(req); MessageBox.Show("Operacija uspješno izvršena!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); frmRedVoznje frm = new frmRedVoznje(_korId); frm.Show(); this.Close(); }