// private async void bunifuThinButton2_Click(object sender, EventArgs e) { foreach (ListViewItem i in listView1.SelectedItems) //Remove the selected item from the list. { if (i.Tag is User) { User u = (User)i.Tag; if (await ApiWrapper.RemoveStudentFromClass(classObj.Id, u.Id)) //If criteria is met, update will also apply to the backend too { listView1.Items.Remove(i); //Remove that selected Tagged student. } } } }
//Removing students from a Class. private async void removeButton_Click(object sender, EventArgs e) { foreach (ListViewItem i in listView1.SelectedItems) //Remove the selected item from the list. { if (i.Tag is User) { User u = (User)i.Tag; if (await ApiWrapper.RemoveStudentFromClass(classObj.Id, u.Id)) //Update the database, so change has been applied serverside. { listView1.Items.Remove(i); } } } }