Skip to content

Instantly share code, notes, and snippets.

@TonyHaddad91
Created November 25, 2016 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TonyHaddad91/92006a8b468200515cc3481348dcb8e5 to your computer and use it in GitHub Desktop.
Save TonyHaddad91/92006a8b468200515cc3481348dcb8e5 to your computer and use it in GitHub Desktop.
Firstly we need to create Basket reposiotry for Basket model and we create an interface for the repository in order to use it in the Controller,
The basket interface will contain add to basket and remove from basket operation and the repository should implement them
Then to add Unit of Work implementation
We need to add unit of works class
which contain an instance of the Basket repository and contain save method in order to save the transaction at the end
At the end in HomeController We Call basket repository instance in unit of work class in order to call the corresponding method from inside it
and once we done all the transactions we need to do we can call unit of work save method in order to save all the transactions we have done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment