public frmObavijestiEdit(int id) { InitializeComponent(); this.AutoValidate = AutoValidate.Disable; _id = id; _o = null; }
private void frmObavijestiEdit_Load(object sender, EventArgs e) { HttpResponseMessage response = obavijestiService.GetResponse(_id.ToString()).Handle(); if (response.IsSuccessStatusCode) { _o = response.GetResponseResult <ObavijestModel>(); FillForm(); } else if (response.StatusCode == System.Net.HttpStatusCode.NotFound) { _o = null; } }
private void btnSnimi_Click(object sender, EventArgs e) { if (this.ValidateChildren()) { var o = new ObavijestModel(); o.Naslov = txtNaslov.Text; o.Tekst = txtTekst.Text; o.Datum = DateTime.Now; o.KorisnikId = Global.PrijavljeniKorisnik.Id; HttpResponseMessage response = obavijestiService.PostResponse(o).Handle(); if (response.IsSuccessStatusCode) { MessageBox.Show(Messages.add_obavijest_succ, Messages.msg_succ, MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } }