
Explore an ASP.NET Core MVC project that consumes a web API, displaying books with multiple offers and categories and enabling add, update, delete, and details navigation.
Download the Book API source code and documentation from the provided files, then set up a local host database with migrations and seeding to start consuming the API.
Create a new .NET core UI project to consume the given API, verify endpoints like /api/books and /api/authors, and run API and UI together via multiple startup projects.
Configure startup to use MVC by adding MVC to services, then set up the app pipeline with static files and MVC in the correct order, including status code pages.
Set up a services folder and use dependency injection to inject interfaces into constructors, enabling flexible retrieval and manipulation of API data across authors, offers, books, reviews, and categories.
Create an interface for country data in services layer to expose methods for getting countries, country by id, country of an offer, and offers from a country, using api dtos.
design repository interfaces for categories, reviews, authors, and books, with methods to fetch all or by id or isbn, and capture related data like ratings and book-author relations.
Define the ICategory interface in Social Explorer services to retrieve categories, fetch category details by id, and get books for a category and categories for a book, returning enumerable collections.
Define an IReviewer interface in the services folder with methods to retrieve all reviewers and to get reviews by reviewer id, and to find a single review by id.
Define a review repository interface with methods to get all reviews for a book and to get the book for a review, in asp.net core mvc.
Create an IAuthor interface in the services folder, defining methods to get offers, get offers by id, get books by author (IEnumerable<BookDetail>), and get offers of a book (IEnumerable<OfferDetail>).
Create an IBook interface in the services folder to retrieve all books as IEnumerable<BookDetail>, and to get a book by id, by ISBN, and its rating as a decimal.
Learn to implement interfaces by creating a country repository class, implementing the GetCountries method, and using an http client with a base address of localhost/api to fetch data.
Call get async method to fetch countries from base address plus countries, then read the response as a list of country details and return it, or empty list on failure.
Create an index view for the countries controller that binds a list of country data objects, displays each country, and adds a detail page link using tag helpers.
Create a partial view named _ViewImports to import tag helpers for all documents, add the exact line registering the tag helpers path, and start using them in views.
Learn to render links to country detail pages in the index view using tag helpers, specifying asp-controller, asp-action, and route parameters, and display validation errors with a bootstrap-styled validation summary.
Create a default layout in the shared folder with a _Layout partial to render body content. Import Bootstrap CSS and scripts and configure _ViewStart to apply the layout.
Configure a default route in ASP.NET Core MVC and test the get countries API to display a country list with detail and delete links, including an empty list scenario.
Implement the get country by id method by mirroring the get countries logic, calling the API at local host/api/countries/{countryId}, and returning the single country detail object to the controller.
Create a get country by id action that retrieves a country by id via the repository, validates the result, and returns a view displaying the country data.
Create get country by id view in asp.net core mvc, bind a country model, show esb validation summary, display country name, and add update and delete actions as bootstrap buttons.
Test get country by id by navigating to the countries list and opening a detail page. Handle nulls by returning a country object and displaying messages for the API call.
Implement the get country of an author method in the country repository to call the offers API and return the offer's country for inclusion in the offer details view.
Implement the get offers from a country method to return offers, rename the data type to offer detail, and update the UI route to countries/{countryId}/offers.
Implement the ICategory interface in a category repository with methods to fetch categories, category by id, and all books for a category, then build a categories controller and views.
Implement the get categories method by building a category repository that implements the interface and returns a category detail list from local host API/categories.
Demonstrate implementing get category by id by duplicating the existing get country by id pattern, adapting it to the category dto, and preparing for get all categories by book.
Implement the get all categories of a book method by reusing the get categories logic and calling /books/{bookId} to fetch and return the book's category details as a CategoryDetail list.
Implement the get all books for category method in ASP.NET Core MVC to return a list of books for a given category id, mirroring the get all categories pattern.
Create a categories controller by inheriting from controller and injecting category repository; implement index action to fetch categories, handle an empty list with an error, and return the view.
Create an index view for the categories controller, list all categories, and add links to details and delete actions; register the category repository in startup.
Create a get category by id action in the categories controller, fetch the category via the repository, handle errors, and return a view with the category or an empty object.
Create the get category by id view in ASP.NET Core MVC using a category model with id and name, display details, and pass category id in update and delete links.
Modify the get category by id action to fetch all books for the category via the category repository, and return a combined category and books object for the details view.
Create a category books view model to combine category details with its related books, exposing a category DTO and a collection of book BDOs named phantom books for the view.
Create and populate a combined view model for category and books, wiring the category and books data into the category books view model and returning it to the view.
Learn how to display books for a category by using the category books view model in the get category by id view, including book links and a no books message.
Test the GetCategoryById action and view in ASP.NET Core MVC, showing category details and its books, and handling categories with no books via a merged view model.
Implement the review repository with methods to get a review by id, list reviews by reviewer and by book, and fetch the book for a specific review.
Implement the GetReviewers method by creating a reviewer repository and wiring API calls to fetch all reviewers, get a reviewer by id, and retrieve reviews for a reviewer.
Implement the GetReviewerById method by adapting the existing get country by id pattern to return a review detail, updating the repository and api route to /api/review.
Implement the get reviewer of a review method in the reviews controller to fetch the reviewer for a given review and return a review detail object.
Implement the GetReviewsByReviewer method to filter reviews by a single reviewer, return review detail objects, update routes, rename reviewers to reviews, and prepare view models.
Implement a review repository that implements the reviews interface, adding get reviews to return a list of review detail, and set the base address to /reviews.
implement a get review by id method by copying and modifying the repository pattern to return a reviewed video object, update the base address, and standardize variable names.
Reuse the get reviews method to implement get reviews of a book, wiring the endpoint /reviews/books/{bookId} to display all reviews on the book detail page.
Implement the get book of review method that returns a single book detail object for a given review id by calling the web api at reviews/{reviewId}/preview.
Create a reviewers controller with an index action that lists all reviewers using the repository and links to a reviewer detail action, mirroring the countries and categories views.
Create and wire a reviewers controller in asp.net core mvc, inject the reviewers repository, implement an index action to fetch and display reviewers, and render the index view.
Create an index view for reviewers that lists first and last names with details and delete links, and register the reviewer repository service in startup.
Define a view model that returns three interconnected objects—a single reviewer, their reviews, and the related books—linked with a review-to-book dictionary.
Create a GetReviewerById action to fetch a reviewer and their reviews, validate existence, handle errors with messages, and prepare a reviews dictionary for the view.
Finish the get reviewer by id action by injecting a review repository, building a review-to-book dictionary from reviews, and returning a view with the reviewer in the view model.
Create a GetReviewerById view to display the reviewer's first and last name and reviews, with each review linked to its book, using the reviews books view model and a dictionary.
Create a GetReviewerById view showing reviewer details and, at the bottom, the reviews and books they reviewed, using the reviewer reviews books view model, layout, lowercase ids, and update/delete links.
Finish the GetReviewerById view by looping through a dictionary of reviews, displaying each book title and the review headline, text, and links to details pages.
Debug a serialization error in the reviewer reviews workflow in an asp.net core mvc app, using postman to validate endpoints and ensure the view model includes the book title.
Create a reviews controller in ASP.NET Core MVC, inject IReviewRepository, and implement index and id actions to fetch all reviews and display a single review, with error messaging when needed.
Create a single, focused view model for a review detail that includes the review, its reviewer, and the book, avoiding a dictionary and exposing three properties: review, reviewer, and book.
Implement a get review by id action in ASP.NET Core MVC, retrieving the review, its reviewer, and the book, handling errors, and returning a review view model.
Create an index view for the reviews controller that lists all reviews using a layout, iterating an IEnumerable<ReviewDetail> and displaying each review's headline with links to details and delete actions.
Create a GetReviewById view that shows a book review with reviewer details, a linked book title, and headline, reading, and text, plus update and delete actions.
Create a GetReviewById view in an ASP.NET Core MVC project, reuse code from GetReviewById, render review details with book and reviewer information, and provide update and delete actions.
Demonstrate testing the GetReviewById action and view in an ASP.NET Core MVC project by navigating reviews, opening detail pages, and verifying links, separators, and navigation flows.
Welcome to Consuming CRUD API in Asp .Net Core MVC.
As the title of the course suggests, we will be building an ASP .Net Core MVC app that consumes and interacts with third-party API.
This course is all about CRUD operations. Step by step, we will set up a complete MVC app that handles API for each of the operations in a multi-table database. For the next several hours, we will dedicate our time to interfaces, dependency injection, 1 to many and many to many database relationships, .Net Core Services, Models, Data Transfer Objects, Controllers, Actions, Views, and of course, C# language. But don’t let any of that scare you. Quite the opposite.
Get excited to learn a ton of new material and dive into the new world of .net core. The course makes the learning easy with the mix of slow introduction of new material, repetition, and lot of practice! Every line of code is coded on camera, there are no mysteriously appearing blocks of code. Every step is explained every time, not just the first time you are introduced to it. And you will have a chance to practice what you learned in homework assignments.
Let’s go over few details. First, let’s discus what this course IS
Introduction to using CRUD API in Asp .Net Core MVC.
We go over creationg of complete API driven MVC app
I introduce new concepts as they are needed in regards to progression of the project
This is a “follow along” and “practice what you learned” course
No code is skipped over.
What this course is NOT:
Complete or Deep Dive course
Learn C# or .net core course
Theory with explanation and code snippets
Ready to Deploy Real World project
1. API are a huge subject, and so is .Net Core. In this course we will build a website that consumes a CRUD API. Nothing more, nothing less. Do not expect a dive into security, database optimization, asynchronous processing or anything else. Just CRUD. Pure and simple. We will work only with C# language inside .net core. So do not expect any javascript or fancy javascript framework or library. There is none in this course. But don’t expect to use this course as a “Learn C# course”. It is not that. I’m sure you will pick up some new syntax and C# tricks, but you do need some C# skills prior to taking this course. The project we use is a great starting point as it introduces several of the essential techniques and concepts, including often neglected CRUD operations on database tables with many-to-many relationships, this certainly isn’t a deploy-ready project.
2. Remember, this is a course, and a practical tutorial. There are lot of courses that will show you the way into one topic and then quickly move on to another topic. This is not one of those courses! My goal is to lead you step by step, all the way, through the new territory inside .net core and introduce you to new concepts and topics and help you learn them. And equally important is to then help you understand and retain what you learned through practice and repetition. If you prefer to be shown something once and then jump to another topic, then this course is NOT for you. If, on the other hand, you learn by combining explanation, coding along, and practicing the concepts while still having the option to see the instructor coding the whole solution, then this course is definitely for you!
3. Did this ever happen to you? You took a course, and you just loved it! Everything was clearly explained, and you had lots of aha moments. Then the course ended…and suddenly, you felt lost. You felt like you learned so much while taking the course, yet could barely remember anything once it ended. Even when you revisited the source code supplied by the instructor, it just didn’t even seem familiar. Suddenly you felt like you didn’t learn anything. All the concepts that seemed so clear during the course felt totally foreign when you were on your own. In my experience, this is often the case when you simply take a course that starts exactly where your current skills are, but moves past the threshold of skills you are ready for. Like trying to go from crawling straight to sprinting. In this course, we go step by step, introducing new concepts slowly and only after you had a chance to practice what you learned.
4. is this course for you? What skills should you have before taking it? If you are a programmer with decent understanding of OOP principles and C#, than you have the all the skills needed to benefit from this course. There are no prerequisites for .net core, or entity framework or how to create an API. Since you are interested in this course, I assume you heard of these things and perhaps played around a little too. That’s all that is needed to take this course.
Well, let's code!