/// <summary> /// Reads the diary file and returns the users diary. /// </summary> public static List <DiaryEntree> ReadDiary() { List <DiaryEntree> diary = new List <DiaryEntree>(); using (StreamReader sw = File.OpenText(diaryPath)) { while (!sw.EndOfStream) { DiaryEntree entree = new DiaryEntree { Title = sw.ReadLine() }; diary.Insert(0, entree); } } return(diary); }
private static void AddDiaryEntree() { Console.WriteLine("Please add a film to your diary."); DiaryEntree diaryEntree = new DiaryEntree { Title = Console.ReadLine() }; Console.WriteLine("When did you watch this film? (dd/MM/yyyy)"); diaryEntree.Date = DateTime.Parse(Console.ReadLine()); List <DiaryEntree> entrees = new List <DiaryEntree> { diaryEntree }; SqliteDataAccess.SaveDiary(user, entrees); diary = SqliteDataAccess.LoadDiary(user); }