Exemplo n.º 1
0
        public int CountingBooks()
        {
            var store = new BookStore();

            int countOf = store.GetCount();

            return(countOf);
        }
Exemplo n.º 2
0
        public IActionResult Delete(int id)
        {
            var store = new BookStore();

            store.RemoveBook(id);

            return(Ok());
        }
Exemplo n.º 3
0
        public IActionResult Put(int id, [FromBody] Book edited)
        {
            edited.id = (int)id;

            Console.WriteLine("Updating book: {0}...", edited.title);

            var store = new BookStore();

            return(new ObjectResult(store.EditedBook(edited)));
        }
Exemplo n.º 4
0
        public IActionResult AddABook([FromBody] Book newBook)
        {
            Console.WriteLine("Inserting book: {0}...");

            var store = new BookStore();

            Book bookObj = store.AddABook(newBook);

            if (null != bookObj)
            {
                return(new ObjectResult(bookObj));
            }
            else
            {
                return(new ObjectResult(new Book()));
            }
        }
Exemplo n.º 5
0
        public IActionResult RetrieveBooks([FromBody] SortedBooks sortObj)
        {
            var bookcase = new BookStore().GetBooks(sortObj);

            return(new ObjectResult(bookcase));
        }
Exemplo n.º 6
0
        public IActionResult SearchBooks(string thing)
        {
            var found = new BookStore().SearchBooks(thing);

            return(new ObjectResult(found));
        }
Exemplo n.º 7
0
        public IActionResult RetrieveBooks()
        {
            var bookcase = new BookStore().GetBooks();

            return(new ObjectResult(bookcase));
        }