Add RemoveItemFromBasket method to IBasketService and BasketService #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request primarily introduces a new feature that allows users to remove items from their shopping basket. Additionally, it includes changes to the web page layout to accommodate this new feature, a change to the database configuration, and the addition of unit tests for the new functionality.
Feature addition:
src/ApplicationCore/Entities/BasketAggregate/Basket.cs: Added aRemoveItemmethod to theBasketclass that allows items to be removed from the basket by their catalog item ID.src/ApplicationCore/Interfaces/IBasketService.cs: Extended theIBasketServiceinterface with aRemoveItemFromBasketmethod.src/ApplicationCore/Services/BasketService.cs: Implemented theRemoveItemFromBasketmethod in theBasketServiceclass. This method removes an item from a given user's basket and updates the basket in the repository.src/Web/Pages/Basket/Index.cshtml.cs: Added aOnPostRemovemethod to theIndexModelclass that removes an item from the basket when the "Remove" button is clicked on the web page.Web page layout changes:
src/Web/Pages/Basket/Index.cshtml: Made changes to the layout of the basket page to include a "Remove" button for each item in the basket. [1] [2] [3] [4]Database configuration change:
src/Infrastructure/Dependencies.cs: Changed theuseOnlyInMemoryDatabasevariable totruein theConfigureServicesmethod. This means that an in-memory database will be used regardless of the configuration setting.Unit tests:
tests/UnitTests/ApplicationCore/Entities/BasketTests/BasketRemoveItem.cs: Added unit tests for theRemoveItemmethod in theBasketclass.