Пример #1
0
        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();
        }
Пример #2
0
        private async void btnSave_Click(object sender, EventArgs e)
        {
            Model.Vozaci voz = new Model.Vozaci()
            {
                Ime     = txtIme.Text,
                Prezime = txtPrezime.Text,
                Vozacka = txtVozKlasa.Text,
                Status  = cbStatus.Checked
            };

            await _vozac.Insert <Model.Vozaci>(voz);

            MessageBox.Show("Operacija uspješno izvršena!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            frmAutobus frm = new frmAutobus(k);

            frm.Show();
            this.Close();
        }