private async void btnSacuvaj_Click(object sender, EventArgs e) { if (ValidateChildren() && await Unique_Validating()) { var request = new PretplateUpsertRequest() { KupacId = int.Parse(cmbKupac.SelectedValue.ToString()), KategorijaVozilaId = int.Parse(cmbKategorijaVozila.SelectedValue.ToString()), Status = cbStatus.Checked, Datum = DateTime.Now }; Model.Pretplate entity = null; if (_id.HasValue) { entity = await _pretplateService.Update <Model.Pretplate>(_id.Value, request); } else { entity = await _pretplateService.Insert <Model.Pretplate>(request); } if (entity != null) { MessageBox.Show("Uspješno izvršeno"); } this.Close(); } }
private async void btnSpremi_Click(object sender, EventArgs e) { if (ValidateChildren()) { var request = new PretplateUpsertRequest() { Datum = DateTime.Now, Status = cbStatus.Checked, KategorijaId = int.Parse(cbKategorija.SelectedValue.ToString()), KlijentId = int.Parse(cbKlijent.SelectedValue.ToString()) }; Model.Pretplate entity = null; if (_id.HasValue) { entity = await _pretplateServices.Update <Model.Pretplate>(_id.Value, request); } else { entity = await _pretplateServices.Insert <Model.Pretplate>(request); } if (entity != null) { MessageBox.Show("Uspješno izvršeno"); } this.Close(); } }