예제 #1
0
        private void btnSpasiPoruku_Click(object sender, EventArgs e)
        {
            if (ValidanUnos())
            {
                var edit = _poruka != null;
                if (!edit)
                {
                    _poruka = new StudentiPoruke();
                }

                _poruka.DatumVrijeme = DateTime.Now;
                _poruka.Poruka       = txtSadrzaj.Text;
                _poruka.Student      = _student;
                _poruka.Slika        = ImageHelper.FromImageToByte(pbSlika.Image);

                if (edit)
                {
                    _db.Entry(_poruka).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    _db.StudentiPoruke.Add(_poruka);
                }
                _db.SaveChanges();
                DialogResult = DialogResult.OK;
                Close();
            }
        }
예제 #2
0
        //public frmNovaPorukaIB150051()
        //{
        //    InitializeComponent();
        //}

        public frmNovaPorukaIB150051(Student student, StudentiPoruke poruka = null)
        {
            InitializeComponent();
            this._student = student;
            this._poruka  = poruka;
        }