// Method to create college by serializing object and sending it to the API public int create(College college) { var result = bc.jsonRequest("/college/create", bc.serialize.Serialize(college)); if (result != null) { College newCollege = bc.serialize.Deserialize<College>(result); return newCollege.id; } else { return 0; } }
// Method to delete college by serializing object and sending it to the API public void delete(College college) { var result = bc.jsonRequest("/college/delete", bc.serialize.Serialize(college)); }
// Method to update college by serializing object and sending it to the API public void updateStatus(College college) { var result = bc.jsonRequest("/college/updatestatus", bc.serialize.Serialize(college)); }
// Method that sends Questionlist object to controller in order to create it in the API private void SaveQuestionList(object sender, EventArgs e) { if (isTextboxEmpty()) { MessageBox.Show("Vul eerst een collegenaam in voordat u opslaat"); } else { College c = new College(); c.title = Input_Name.Text; c.user = bc.user.id; int id = bc.cc.create(c); d = bc.cc.getColleges(); foreach (College D in d) { if (D.title == c.title) { c.id = D.id; } else { } } foreach (Questionlist q in tempQL) { bc.cc.addQuestionlist(id, q.id); } MessageBox.Show("Uw college is aangemaakt"); bc.cc.setOverviewPanel(); } }