Exemplo n.º 1
0
        /// <summary>
        /// Method for changing the title of a book
        /// </summary>
        /// <param name="admin">Takes a user with admin priviliges</param>
        /// <param name="book">Takes a book to change title on</param>
        private static void ChangeTitle(User admin, Book book)
        {
            var continueLoop = true;

            do
            {
                AdminView.ChangeTitle();
                var input = InputHelper.InputFreeText();
                if (string.IsNullOrEmpty(input))
                {
                    SharedError.EmptyInput();
                    continue;
                }
                if (book.Title != input)
                {
                    book.Title = input;
                    api.UpdateBook(admin.Id, book.Id, book.Title, book.Author, book.Price);
                    continueLoop = false;
                }
            } while (continueLoop);
        }