private static void GetBookData() { int id = (new Random()).Next(1, 1000); string title; string author; Console.Write("Please, enter book Id: "); try { id = Convert.ToInt32(Console.ReadLine()); } catch (Exception ex) { Console.WriteLine(ex.Message); return; } Console.Write("Please, enter book title: "); try { title = Console.ReadLine(); } catch (Exception ex) { Console.WriteLine(ex.Message); return; } Console.Write("Please, enter book author: "); try { author = Console.ReadLine(); } catch (Exception ex) { Console.WriteLine(ex.Message); return; } IPublication _ = new BookModule(); _.Create(id, title, author); }
public void Create(int id, string title, string author) { string stringToAppend = new BookModule(id, title, author).ToString(); File.AppendAllText(_path, stringToAppend); }