Exemplo n.º 1
0
        /// <summary>
        /// Allows you to view all book categories
        /// </summary>
        public void ViewAllCategories()
        {
            WebbShopAPI api = new WebbShopAPI();
            var         listOfCategories = api.GetCategories().ToList();

            if (listOfCategories != null)
            {
                var sortCategoryList = listOfCategories.OrderBy(c => c.ID).ToList();
                BookViews.DisplayCategoryList(sortCategoryList);
                return;
            }

            MessageViews.DisplayErrorMessage();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Allows you to search for a specific category
        /// </summary>
        public void SearchFunctionCategories()
        {
            BookViews.SearchPage();
            var keyword = Console.ReadLine();

            if (keyword != "")
            {
                WebbShopAPI api = new WebbShopAPI();
                var         listOfCategories = api.GetCategories(keyword).ToList();
                if (listOfCategories != null)
                {
                    BookViews.DisplayCategoryList(listOfCategories);
                    return;
                }
            }

            MessageViews.DisplayErrorMessage();
        }