public override void Display() { var list = DataService.GetChilds(ParentId); var possibleIds = list.Select(x => x.Id); DisplayHelpers.WriteTable("display top level", list); if (list.Any()) { var intValue = Input.ReadInt(); this.ParentId = intValue; } else { this.ParentId = null; } Input.ReadString("Press [Enter] to navigate"); var dlp = Program.SetPage <DisplayListPage>(); Input.ReadString("Press [Enter] to navigate home"); Program.NavigateBack(); }
public override void Display() { var topLevel = DataService.Get(CurrentParentID); if (string.IsNullOrEmpty(topLevel.Name)) { var str = string.Format("Category name: {0}", topLevel.Name); Output.WriteLine(ConsoleColor.Green, str); } DisplayHelpers.WriteTable("Choose category to delete", topLevel.Childs); var itemToRemoveId = Input.ReadInt(); var possibleIds = topLevel.Childs.Select(x => x.Id); if (possibleIds.Contains(itemToRemoveId)) { DataService.Remove(itemToRemoveId); Output.WriteLine("Item deleted"); } else { Output.DisplayPrompt("Item cannot be deleted"); } Input.ReadString("Press [Enter] to navigate home"); Program.NavigateBack(); }
public override void Display() { var topLevel = DataService.GetTopLevel(); DisplayHelpers.WriteTable("display top level", topLevel); Input.ReadString("Press [Enter] to navigate home"); Program.NavigateBack(); }