private async void BtnSacuvaj_Click(object sender, EventArgs e) { if (this.ValidateChildren()) { var request = new TroskoviInsertRequest() { Sifra = txtSifra.Text, PredmetID = int.Parse(cbPredmet.SelectedValue.ToString()), DatumUplate = dtpDatumUplate.Value, Iznos = decimal.Parse(txtIznos.Text), Opis = txtOpis.Text, IsDeleted = false }; if (_id.HasValue) { await _aPIServiceTroskovi.Update <Model.Troskovi>(_id, request); MessageBox.Show(Properties.Resources.MessageBoxForSave); this.Hide(); frm2.RefreshData(); } else { await _aPIServiceTroskovi.Insert <Model.Troskovi>(request); MessageBox.Show(Properties.Resources.MessageBoxForSave); this.Hide(); frmTroskovi frm = new frmTroskovi(); frm.Show(); } } }
public frmTroskoviDetalji(int?trosakId = null, frmTroskovi frm1 = null) { InitializeComponent(); _id = trosakId; frm2 = frm1; this.AutoValidate = AutoValidate.Disable; }