July 2019
Intermediate to advanced
410 pages
10h 32m
English
The GetInventoryCommand command differs from the previous two commands because it does not require any parameters. It does use the IUserInterface dependency and the IInventoryContext dependency to write the content of the collection. This is shown as follows:
internal class GetInventoryCommand : NonTerminatingCommand{ private readonly IInventoryContext _context; internal GetInventoryCommand(IUserInterface userInterface, IInventoryContext context) : base(userInterface) { _context = context; } protected override bool InternalCommand() { foreach (var book in _context.GetBooks()) { Interface.WriteMessage($"{book.Name,-30}\tQuantity:{book.Quantity}"); } return true; }}
With the GetInventoryCommand command implemented, the ...
Read now
Unlock full access