asp.net core
Create an Asp.Net Core MVC app with the repository pattern Part 1 – Create the model
So let’s create an ASP.NET Core MVC app that also implements the repository pattern. You can follow along here. First create the models. This is a coffee app where a customer can order coffee. Great work! Now in the next post we’ll create an interface.
Create an Asp.Net Core MVC app with the repository pattern Part 2 – Create the interface
Now it’s time to create the interface we need. This interface only presents one option and that is to get all orders. Next post we will write a MockRepository which we can populate with some mockdata.
Create an Asp.Net Core MVC app with the repository pattern Part 3 – Create a MockRepository
Now it’s time to create a MockRepository that inherits from the interface it’s method. Inside the constructor we create some mockdata with orders. Now in the method GetAllOrders return the list of orders. Next let’s create a controller that implements the Order interface repository.
Create an Asp.Net Core MVC app with the repository pattern Part 5 – Create a Controller that implements the order interface.
Now inside the Startup.cs of the MVC app tell the app that any time someone asks for IEmployeerepository it provides the mock repository. So the power of a repository is now that any time you want to change the source data you can just change this one line of code with another repository. Now in […]
Create an Asp.Net Core MVC app with the repository pattern Part 6 – Create a view for the controller.
Finally create a new View and assign it the model of type Order. Now launch the app and head over to the Order page to see the result! Awesome! Great work!
You must be logged in to post a comment.