private static bool LoadModels(string fileName) { List <string> models = null; try { models = new List <string>(); string[] lines = System.IO.File.ReadAllLines(fileName); int i = 0; while (i <= lines.Length) { HaikuModel model = new HaikuModel(); model.FirstVerseModel = lines[i]; model.SecondVerseModel = lines[i + 1]; model.ThirdVerseModel = lines[i + 2]; HaikuDBAccess.SaveHaikuModel(model); i += 4; } } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } return(true); }
/// <summary> /// Saves the haiku word. /// </summary> /// <param name="haikuWord">The haiku word.</param> public static void SaveHaikuModel(HaikuModel haikuModel) { db.Models.Add(haikuModel); db.SaveChanges(); }