
Explore building an async ASP.NET Core and EF Core API for comedy events, venues, comedians, and gigs, with CRUD operations, relationships, DTO vs entity mapping, and flexible get queries.
Download the source code from Udemy resources or GitHub with commit history, compare it to the final code, and use the Udemy Q&A for help while following the videos.
Create an empty ASP.NET Core project, enable MVC in the service configuration, and configure the app to use MVC with compatibility version 2.0 for a modular startup workflow.
Configure the db context by overriding on configuring and using the options builder to set the comedy event connection string from the json file, then seed the database with data.
Learn how to seed an EF Core database using the model builder, configuring entities like event, venue, gig, and comedian with initial data.
Add the db context to services, create an initial migration, and update the database to seed comedians, venues, events, and gigs with their foreign keys.
Create an async api for events in asp.net core, exposing endpoints to get all events, get an event by id, and fetch events by date with optional include gigs.
Create an interface for gigs in an async api using asp.net core, enabling get gigs by event or venue, fetch a single gig by event, and optionally include comedians.
Create an asynchronous ASP.NET Core API with EF Core to manage comedians: fetch all, fetch by event, fetch by id, and support create, update, delete via a repository.
Implement the event repository class from the event repository interface, inject the event context and the logger interface via the constructor, and set private readonly fields.
Implement add, delete, and update methods with logging, add or remove entities in the context, and use a save changes async method in the repository, returning true when successful.
Implement get methods for comedians interface using EF Core. Retrieve a single comedian by id with logging, all comedians ordered by last name, and comedians for an event via gigs.
Implement get methods for events in asp.net core, returning a single event by id with optional gigs, venue, and comedians, and list all events ordered by date.
Refactor and implement get gig methods in the gigs interface, enabling async retrieval by gig id, by event, and by venue, including comedians and related event and venue when requested.
Create an events controller in ASP.NET core, mark it as an api controller, and inherit from controller base. Inject the event repository via constructor and use the api route api/events.
Create an async get events action that returns a collection of events, accepts an include gigs flag, and handles errors with a 500 internal server error while leveraging a repository.
Register the IEventRepository in startup and test the API with Postman. Fix reference looping by ignoring loops with json options and detail classes to limit data.
design and implement detail data transfer object classes for comedians, gigs, venues, and events, apply validation annotations, and return dto models instead of entities in API responses.
Replace manual property assignment with AutoMapper in an ASP.NET Core API to map event detail to event video, inject IMapper, register the mapper in startup, and verify results with Postman.
Create an async get event action in the events controller to return a single event by id, optionally including gigs, using a repository and mapper, with 404 and 200 responses.
Implement a get by date action in the api to fetch events for a given date; include an optional include gigs flag and route api/events/search.
Implement a public async post action to create an event by mapping input to the event entity, saving via a repository, and redirecting to the event with a link generator.
Testing and debugging foreign keys in an async api with ASP.NET Core and EF Core. Diagnose a 500 error when posting events and ensure venue id is the foreign key.
Create a put action to update an existing event from a detail object, map to the old event, and save via the repository with not found and no content responses.
Define an AutoMapper profile to map the event to event video and enable reverse mapping, while excluding the venue so updates affect only the event.
Implement a delete action for events by id using the repository, retrieving the event and deleting it by its id. Return no content and handle database failures.
create an api comedian controller inheriting from the controller base, inject the event repository, mapper, and link generator, and configure the route api/comedians to support get, create, update, and delete comedians.
Implement the get comedians action in the comedians controller by reusing the event get method, returning a collection of comedian DTOs mapped from entities, with error handling for database failures.
Implement an async GetComedian action to return a comedian by id via repository, map comedian CTO to entity, and handle not found or database failure; prepare GetComedians by event.
Test get requests for comedians, fetch all and by id, resolve the ambiguous match exception with api/comedians/search and eventId, then test search by event id before post update and delete.
Create a post action in the comedians controller to post a comedian, map the request body to the entity, save it via the repository, and return created with the location.
Update a comedian via a put action by fetching original comedian by id, mapping new data from the request body, and saving, returning not found or bad request on failure.
Run tests against the api to fetch gigs by id, venue, and event, including comedians when requested. Demonstrate that get actions work and outline upcoming post, put, and delete operations.
Create a venues api controller and implement post, put, and delete actions by mapping venue details to entities, using events to locate venues, and returning no content with 500 handling.
Demonstrates posting, updating, and deleting venue data via api/venues, assigning venues to events, and validating changes in the database.
Revisit your progress and solidify skills in building an MVC API with ASP.NET Core, mapping DTOs to entities, configuring dependency injection, repositories, and CRUD operations.
Welcome to Crash Course on Creating API with ASP .Net Core
This course is all about creating a functional Async API using .Net Core and Entity Framework. Step by step, we will set up a complete API to handle each of the operations in a multi-table database. We'll develop all necessary entities, Data Transfer Objects, Interfaces, use dependency injection to inject services for our app, design fully MVC structure, map entities to DTO object with automapper, turn our Controllers into fully functional API controllers, handle relationships, keys and foreign keys in our database tables and Models, use Entity Framework as a back end utilizing Code-First integration, seed the database with dummy data... you get the picture!
So in the next several hours, you will go from an API novice to a developer capable of developing - and understanding - basic API structure,
Get excited to learn a ton of new material and dive into the new world of .net core. This is a relatively fast-paced course, designed with a busy self-learner in mind. If you like to be shown a concept and then move on to another concept to learn more, then this course is for you. No time is wasted.
Everything is coded on camera, including some mistakes, both intentional and unintentional. This allows us to go over some concepts that would be hard to explain and understand, such as Reference Loop Handling, AutoMapping set up, possible problems with DTO objects and others.
So buckle up, get a big cup of coffee, and get ready to finally understand what all this fuss about API's and REST is about.
Let's code