private void RemoveGroup(object sender, EventArgs e) { removeButton.Visible = true; int id = Convert.ToInt32(dataGridView1.SelectedCells[0].Value.ToString()); var group = repositoryGroup.FindById(id); group.Tests.Clear(); group.Users.Clear(); repositoryGroup.Update(group); repositoryGroup.Remove(group); dataGridView1.DataSource = repositoryGroup.GetAll().Select(x => new { Id = x.Id, Tille = x.Title }).ToList(); }
private void AddUserSelected(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { foreach (DataGridViewRow row in dataGridView1.SelectedRows) { var group = (Group)comboBox1.SelectedItem; if (group != null) { User user = repositoryUser.FindById(row.Cells[0].Value); user.Groups.Add(group); repositoryUser.Update(user); } } } }
private void AddTestSelected(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { foreach (DataGridViewRow row in dataGridView1.SelectedRows) { var group = (Group)comboBox1.SelectedItem; if (group != null) { Test test = repositoryTest.FindById(row.Cells[0].Value); test.Groups.Add(group); repositoryTest.Update(test); } } } }