public IBaseCommand CreateProduct() { System.Console.WriteLine("Available records type :"); Debug.Assert(_records.Keys != null, "_records.Keys != null"); foreach (var recordKey in _records.Keys) { System.Console.WriteLine(recordKey); } System.Console.WriteLine("Enter record type to add it to notebook"); IBooknoteRecord record = null; try { var line = System.Console.ReadLine(); if (line == null) { return(new NopeCommand()); } var creator = _records[line]; record = creator?.CreateProduct(); } catch (KeyNotFoundException) { System.Console.WriteLine("Unknown booknote type!"); } return(new AddRecordCommand(_booknote, record)); }
public void Add(IBooknoteRecord booknoteRecord) { _records.Add(booknoteRecord); }
public AddRecordCommand([NotNull] Booknote booknote, IBooknoteRecord record) { _booknote = booknote; _record = record; }