예제 #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();
        }
예제 #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();
        }