public static void SaveGradebook(GradebookModel gradebook) { XmlSerializer serializer = new XmlSerializer(typeof(GradebookModel)); using (StreamWriter writer = new StreamWriter(PATH)) { serializer.Serialize(writer, gradebook); } }
public static GradebookModel getGradebook() { GradebookModel gradebook = new GradebookModel(); XmlSerializer deserializer = new XmlSerializer(typeof(GradebookModel)); try { using (StreamReader reader = new StreamReader(PATH)) { gradebook = (GradebookModel)deserializer.Deserialize(reader); } } catch (FileNotFoundException) { //TODO: Do Something } return gradebook; }
public void Save() { GradebookModel _gradebook = new GradebookModel(this); GradebookDao.SaveGradebook(_gradebook); StateManager.Clean(); }