3. Console Demo - Gluzberg/cart-client GitHub Wiki
-
Please follow the Clone and Build instructions in 1. Getting-Started.
-
To run the Console Demo, please enter:
cd CartClient.Demo dotnet run
-
The following then shall be prompted:
Please enter action one of the actions: (c)reate (cart ID) (i)nfo (cart ID) (a)dd (cart ID) (Product ID) (Amount) (m)odify (cart ID) (Product ID) (Amount) (r)remove (cart ID) (Product ID) (d)elete (cart ID) (Product ID) (q)uit >_
Create a cart with the specified Cart ID.
-
Format
c (Cart ID):Guid
-
Sample Call
> c 270f4c84-5709-431a-a3aa-730e0974a3d3
-
Response
-
Success
Action was Successful { "CartId": "270f4c84-5709-431a-a3aa-730e0974a3d3", "Products": [] }
-
Fail
In case of:
- A cart with the specified Cart ID already exists
- Data storage error
Action was Unsuccessful
-
Retrieve the details of cart the specified Cart ID.
-
Format
i (Cart ID):Guid
-
Sample Call
> i 270f4c84-5709-431a-a3aa-730e0974a3d3
-
Response
-
Success
Action was Successful { "CartId": "270f4c84-5709-431a-a3aa-730e0974a3d3", "Products": [] }
-
Fail
In case of:
- A cart with the specified Cart ID does not exist
- Data storage error
Action was Unsuccessful
-
Add product with specified Product ID to the cart with the specified Cart ID.
-
Format
i (Cart ID):Guid (Product ID):Guid (Amount):uint
-
Sample Call
> a 270f4c84-5709-431a-a3aa-730e0974a3d3 170f4c84-5709-431a-a3aa-730e0974a3d3 17
-
Response
-
Success
Action was Successful { "CartId": "270f4c84-5709-431a-a3aa-730e0974a3d3", "Products": [ { "ProductId": "170f4c84-5709-431a-a3aa-730e0974a3d3", "Amount": 17 } ] }
-
Fail
In case of:
- A product with the specified Product ID is already in the specified cart
- A cart with the specified Cart ID does not exist
- Data storage error
Action was Unsuccessful
-
Modify the amount of the product with specified Product ID to the cart with the specified Cart ID.
-
Format
m (Cart ID):Guid (Product ID):Guid (Amount):uint
-
Sample Call
> m 270f4c84-5709-431a-a3aa-730e0974a3d3 170f4c84-5709-431a-a3aa-730e0974a3d3 9
-
Response
-
Success
Action was Successful { "CartId": "270f4c84-5709-431a-a3aa-730e0974a3d3", "Products": [ { "ProductId": "170f4c84-5709-431a-a3aa-730e0974a3d3", "Amount": 9 } ] }
-
Fail
In case of:
- A product with the specified Product ID does not exist in the specified cart
- A cart with the specified Cart ID does not exist
- Data storage error
Action was Unsuccessful
-
Remove Product Amount from Cart
Remove the product with specified Product ID to the cart with the specified Cart ID.
-
Format
r (Cart ID):Guid (Product ID):Guid
-
Sample Call
> r 270f4c84-5709-431a-a3aa-730e0974a3d3
-
Response
-
Success
Action was Successful { "CartId": "270f4c84-5709-431a-a3aa-730e0974a3d3", "Products": [] }
-
Fail
In case of:
- A product with the specified Product ID does not exist in the specified cart
- A cart with the specified Cart ID does not exist
- Data storage error
Action was Unsuccessful
-
Delete the cart with the specified Cart ID.
-
Format
d (Cart ID):Guid
-
Sample Call
> d 270f4c84-5709-431a-a3aa-730e0974a3d3
-
Response
-
Success
Action was Successful
-
Fail
In case of:
- A cart with the specified Cart ID does not exist
- Data storage error
Action was Unsuccessful
-
Quit Demo application.
-
Format
d (Cart ID):Guid
-
Sample Call
> q
-
Response
-
Success
Client quited
-
In case of an invalid action specification the following notice will be prompted:
Invalid action specification