Esempio n. 1
0
        /// <summary>
        /// Allows an admin user to add a new book
        /// </summary>
        /// <param name="adminId"></param>
        private void AddBook(int adminId)
        {
            AdminView.AddBookPage();
            var title  = Console.ReadLine();
            var author = Console.ReadLine();
            var price  = InputHelper.ParseInput();
            var amount = InputHelper.ParseInput();

            if (title != "" && author != "" && price != 0 && amount != 0)
            {
                WebbShopAPI api    = new WebbShopAPI();
                bool        result = api.AddBook(adminId, title, author, price, amount);
                if (result)
                {
                    MessageViews.DisplaySuccessMessage();
                    return;
                }
            }

            MessageViews.DisplayErrorMessage();
        }