private async void buttonAutoriDodaj_Click(object sender, EventArgs e) { FormDodajAutora form = new FormDodajAutora(); if (form.ShowDialog() == DialogResult.OK) { var listaautora = await _Autorapiservice.get <List <Model.Autor> >(null); dataGridViewAutori.DataSource = listaautora; if (id != null) { var autoriknjigelist = await _autorKnjigaservice.get <List <Model.EKnjigeAutor> >(null); var knjiga = await _apiservice.getbyId <Model.EKnjiga>(id); foreach (DataGridViewRow item in dataGridViewAutori.Rows) { bool tacan = false; foreach (var ka in autoriknjigelist) { int autorid = int.Parse(item.Cells[1].Value.ToString()); if (ka.EKnjigaID == knjiga.EKnjigaID && autorid == ka.AutorID) { tacan = true; break; } } if (tacan) { item.Cells[0].Value = true; } else { item.Cells[0].Value = false; } } } else { foreach (DataGridViewRow item in dataGridViewAutori.Rows) { item.Cells[0].Value = false; } } } }
private void autoriToolStripMenuItem_Click(object sender, EventArgs e) { FormDodajAutora form = new FormDodajAutora(); form.Show(); }