Readme for MyBookStore Solution
Features implemented for MyBookstore
- Display all books
- Search by Tile, Author or Both
- Add a Book to Cart
- View Cart to see all books Added, with Cart Total
- Place an Order from Cart
- Order Summary, that displays Available and Out Of Stock Books, with the Total value of Available books in the Cart
Solution Dependencies
- Newton soft.Json, to work with Json Data (Downloaded from NuGet)
DataStore
- For WebSite MyBookStore\Files\books.txt (for reading book information and saving to Cart)
- Data structure is but modified to a. Each book is assigned a ISBN, id to uniquely identify the book b. Cart, a field to store the cart quantity
- For Unit testing the project has its own books.txt for data reading and writing
Running the Solution
- Get latest of Solution and Build it
- The Startup project is MyBookStore (MVC web project)
- Run it in debug or release mode (whichever is the preference)
- Ensure the following files have written attributes MyBookStore. Tests\Files\books.txt and MyBookStore\MyBookStore\Files\books.txt
Navigating/Testing the Solution
- By Default on Startup, a List of Books will be displayed
- If Not there is a menu option "Books" available to view the list of Books
- Search Fields are available for Title and Author (Search runs a contains search)
- Title, Author or both can be searched together
- For each Book, an Add to Cart link, will add 1 quantity to the cart
- Same Book can be added to the cart multiple times, the cart quantity for each book is updated
- Add to Cart feature does not validate the available stock quantity of the book
- To View Cart Items, Click on the cart Menu Option
- The Cart page displays the order total of all items in the cart (sum of book price multiplied by cart quantity)
- Place an Order link is provided at the bottom to view available and unavailable books
- On to of Order page Order Value is displayed (sum of book price multiplied by available quantity)
- If the cart quantity for a book is more than stock quantity, the book is displayed in Available as well as unavailable with their respective quantities
- Clicking on Place an Order, resets the cart quantity to zero, but keeps the cart quantity intact (for retesting the solution)
- After placing and order, Navigate to Books to start again
Projects in the MyBookStore solution
- MyBookStore.csproj Website Solution to display books and cart The website invokes the business logic through an Interface Search and Add to Cart are implemented through Ajax Calls
- MyBookStore. BusinessLogic.csproj Implemented the business logic, for Search and Validation The project contains Interface and Concrete Class Business Logic invokes data access through the Storage service interface
- MyBookStore. DataAccess.csproj The project contains interface and concrete classes for working with the file based data store The project provides methods for reading and writing JSON object to books.txt file
- MyBookStore. Entities.csproj This project is a data model shared by all projects It contains Books and Cart Entities
- MyBookStore. Tests.csproj The project unit test the controllers and all their actions for different scenarios All or Individual Tests can be run from the test explorer.
Error Handling
- Exception is handled primarily for user actions, such as PageLoad and Ajax Calls
- On an Error on any page or user action, appropriate error (alert in red) or information(in green) is displayed