Example #1
0
 public static void SaveGradebook(GradebookModel gradebook)
 {
     XmlSerializer serializer = new XmlSerializer(typeof(GradebookModel));
     using (StreamWriter writer = new StreamWriter(PATH))
     {
         serializer.Serialize(writer, gradebook);
     }
 }
Example #2
0
        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();
        }