public int DeleteSchoolByName(string name) { int returnCode; // Checking name if (name != null) { // Looking if School exists in DB Schools deletingSchool; deletingSchool = SchoolUtils.LookForSchool(name); if (deletingSchool != null) { // If school exists => Try to delete // Check if school has rooms if (SchoolUtils.SchoolHadRooms(deletingSchool)) { // Impossible to delete a school, return -1 returnCode = -1; } else { // School can be deleted safely returnCode = SchoolUtils.DeleteSchool(name); } } else { // If school not existing => School not deleted, returns 0 returnCode = 0; } } else { // Arguments not valid returnCode = -1; } return(returnCode); }
public int DeleteSchoolByID(int?id) { int returnCode; // Checking id if (id != null) { // Looking if School exists in DB Schools deletingSchool; deletingSchool = SchoolUtils.LookForSchool((int)id); if (deletingSchool != null) {// If school exists => Try to delete returnCode = SchoolUtils.DeleteSchool((int)id); } else {// If school not existing => School not deleted, returns 0 returnCode = 0; } } else { // Arguments not valid returnCode = -1; } return(returnCode); }