Exemple #1
0
        private async void DgvModeli_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvModeli.Columns[e.ColumnIndex].Name == "Izmjeni")
            {
                var id = dgvModeli.Rows[e.RowIndex].Cells[0].Value;

                frmModelDetalji forma = new frmModelDetalji(int.Parse(id.ToString()), this);
                forma.Show();
            }

            else if (dgvModeli.Columns[e.ColumnIndex].Name == "Obriši")
            {
                var id = dgvModeli.Rows[e.RowIndex].Cells[0].Value;
                if (MessageBox.Show("Da li ste sigurni da želite obrisati ovaj zapis?", "Poruka", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    HttpResponseMessage delete = await _apiService.Delete(id);

                    if (delete.StatusCode != System.Net.HttpStatusCode.InternalServerError)
                    {
                        await RefreshModeli();

                        MessageBox.Show("Zapis uspješno obrisan");
                    }
                }
            }
        }
Exemple #2
0
        public void PrikaziFormu()
        {
            frmModelDetalji forma = new frmModelDetalji(null, this);

            forma.Show();
        }