Esempio n. 1
0
        /// <summary>
        /// Allows an admin user to add a book to category
        /// </summary>
        /// <param name="adminId"></param>
        private void AddBookToCategory(int adminId)
        {
            AdminView.AddBookCategory();
            new Book().SearchBooksByTitle();
            MessageViews.DisplaySelectMessage();
            var bookId = InputHelper.ParseInput();

            new Book().ViewAllCategories();
            MessageViews.DisplaySelectMessage();
            MessageViews.DisplayReturnMessage();

            var categoryId = InputHelper.ParseInput();

            if (categoryId == 0)
            {
                return;
            }

            if (bookId != 0 && categoryId != 0)
            {
                WebbShopAPI api    = new WebbShopAPI();
                var         result = api.AddBookToCategory(adminId, bookId, categoryId);
                if (result)
                {
                    MessageViews.DisplaySuccessMessage();
                    return;
                }
            }

            MessageViews.DisplayErrorMessage();
        }