コード例 #1
0
        public frmObavijestiEdit(int id)
        {
            InitializeComponent();
            this.AutoValidate = AutoValidate.Disable;

            _id = id;
            _o  = null;
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        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();
                }
            }
        }