
Learn to build an ASP.NET Core Web API from scratch using .NET 8, with restful patterns, Entity Framework, SQL Server, authentication, role-based authorization, fluent validation, asynchronous programming, and AutoMapper.
Ensure you have at least three months of experience with C# and ASP.NET Core or ASP.NET MVC, plus basic knowledge of APIs and the .NET ecosystem.
Identify and install the tools, languages, and frameworks needed to build a web API, including Visual Studio 2022, .NET Core SDK and Runtime, SQL Server, and SQL Server Management Studio.
Download and install Visual Studio 2022, selecting the community edition for Windows, then choose the ASP.NET and web development workload with .NET development and data storage options for SQL Server.
Download and install dotnet 8 sdk and runtime for windows 64-bit from the official dotnet website to set up a dotnet 8 api development environment.
Install SQL Server 2019 Developer Edition and SQL Server Management Studio, connect to the local SQL Server instance, and prepare to create a new database for the web API.
Follow the entire video to avoid missing key information and errors, and seek online help from Stack Overflow or other developers when needed.
Access the complete asp.net core web api code on GitHub, with sectioned commits and notes, clone the repository locally, and compare your changes to the author's at each section.
Create an ASP.NET Core Web API with Visual Studio, explore scaffolding, routing, REST principles and HTTP verbs, build domain models, use entity framework core, and test with Swagger and Postman.
Create a new asp.net core web api in visual studio using the rest template, configuring NZ walks with dotnet eight and authentication set to none.
Explore the ASP.NET Core web API project scaffold in Visual Studio, including solution, csproj, and launch settings. Understand how appsettings.json and program.cs configure dependencies and the HTTP request pipeline.
Explore REST architecture and the resource-based design of web services, using URIs and HTTP verbs (GET, POST, PUT, DELETE) to perform actions in a stateless client-server model with ASP.NET Core.
Explore routing in ASP.NET Core web APIs by mapping incoming requests to the correct controller and action, then delete a product via the HTTP delete attribute using the URL ID.
Run and test an ASP.NET Core Web API with Swagger to explore endpoints like weather forecast and a students controller, then verify responses with Swagger or Postman.
Design and implement a domain-driven web api to manage New Zealand walks, regions, and difficulties, defining domain models for walk, region, and difficulty and enabling full CRUD operations.
Create domain models for difficulty, region, and work, with non-nullable ids and names, a nullable region image URL, and entity framework core navigation properties linking difficulty and region.
Install the Microsoft.EntityFrameworkCore.SqlServer and Microsoft.EntityFrameworkCore.Tools NuGet packages to enable SQL Server connectivity and migrations, then prepare to create a dbcontext class.
Create and configure a DbContext in ASP.NET Core with Entity Framework Core, defining DbSet properties for difficulty, region, and walk to map domain models to database tables.
Create a connection string in appsettings.json to connect to a SQL Server database with Entity Framework Core, naming it NZ Walks Connection string and including server, database, and trust settings.
Learn how dependency injection in ASP.NET Core uses a built-in container to inject the NZ Walks DbContext via Program.cs, wiring the SQL Server connection string from appsettings.json.
Run EF Core migrations from the NuGet Package Manager Console to scaffold an initial migration and update the database, creating the NZ Walks DB with tables and relationships.
Create endpoints for an ASP.NET Core Web API by building controllers and action methods to perform CRUD operations on the region table.
Create a regions controller in an ASP.NET Core API to perform CRUD operations on the region domain model, exposing routes under api/regions and testing with swagger.
Learn to fetch all regions from the database using a DbContext in an ASP.NET Core Web API, replacing hardcoded data with real data via dependency injection and Entity Framework Core.
Create a get region by id action in a .NET 8 web api. Retrieve the region by id from the route using dbcontext.find or firstOrDefault and return 200 or 404.
Explore the difference between DTOs and domain models, and learn to map them with Entity Framework Core, sending DTOs to clients for secure, efficient data transfer.
Convert api methods to return region dto objects by mapping domain models to dto. Decoupling the api view layer from domain models and returning dto improves clarity.
Implement a post action to create a region using add region request dto, map to the domain model, save with DbContext, and return 201 created with a location header.
Update the region via a put endpoint using the id from the route and an update region DTO. Save changes using DbContext and return the updated region DTO.
Implement a delete region method in a .NET8 web API using http delete, route by id, validate existence with the dbcontext, delete, save changes, and return 200 or 404.
Learn asynchronous programming, convert controller methods to async, implement the repository pattern with repositories, and use Automapper for object-to-object mappings.
Explore asynchronous programming in ASP.NET Core using async and await, and implement async DbContext calls with Entity Framework Core to boost performance.
Learn how the repository pattern decouples data access from the application in asp.net core, using an abstraction layer and a standard interface for CRUD operations.
Implement a region repository interface with CRUD methods and its sql region repository, wired via dependency injection, enabling easy data source swaps with an in-memory alternative.
Implement get by id, create async, update async, and delete async methods in the region repository, refactor the controller to use the repository, and perform asynchronous CRUD operations.
Learn how AutoMapper simplifies object-to-object mappings in ASP.NET Core by centralizing source-to-destination mappings, reducing manual copying, and improving maintainability.
Implement AutoMapper to simplify mapping between domain models and dtos, configure a mapping profile, and inject it at startup to streamline create, read, update, and delete operations.
Seed data with entity framework core to define VOCs difficulty levels and regions, then create the VOCs controller with CRUD operations and explore navigation properties.
Seed easy, medium, and hard difficulties and Auckland region data into the database using entity framework core by seeding in the on model creating method.
Create a post endpoint at api/walks to add new walks using an add walk request DTO, automapper, and a repository with a db context.
Implement a get all action in the walks controller to retrieve all walks via the repository, map domain models to DTOs with AutoMapper, and return a 200 ok response.
Learn how entity framework core navigation properties fetch related data for walks, regions, and difficulties using include, with DTO mappings and repository patterns.
Implement an asynchronous get-by-id action in the walks controller, retrieving the walk by id with related difficulty and region, mapping to a DTO, and returning 404 if not found.
Update a walk by id with a put request to api/walks/{id}, using an update walk request DTO mapped to the domain model, then return the updated walk or not found.
Implement delete operation for the walks API: add repository delete async, remove by id, save changes, and return 200 with deleted walk DTO or 404 if not found.
Apply model validations in your ASP.NET Core Web API to ensure incoming data is valid for add, update, and delete operations, returning http 400 for invalid requests.
Apply data annotations to region and VOC request DTOs to enforce model validations on endpoints. Use ModelState to validate create and update requests and return bad requests when data fails.
Create a custom validate model attribute with an action filter to centralize model state checks. It automatically returns a 400 bad request when models are invalid, keeping controllers reusable.
Learn to filter and sort results in your ASP.NET Core Web API and implement pagination to enable efficient data navigation.
Seed a SQL Server database by running a script from the notes that deletes existing data and inserts rows into regions, difficulties, and walks tables in networks DB.
Demonstrates filtering in an asp.net core web api with query parameters to filter by name on the get all works endpoint, through controller and repository changes.
Learn how to implement sorting in an ASP.NET Core Web API by name or length, with ascending or descending order, integrated with filtering on the get all method.
Implement pagination in an ASP.NET Core Web API using page number and page size query parameters. Apply skip and take logic after filtering and sorting to return scalable, client-friendly data.
Implement authentication and authorization in an ASP.NET Core web API, blocking public access and using roles, policies, and claims to control who can read or modify resources.
Understand the authentication flow: the server creates and passes a JWT token to the client, which uses it to access the API and the API validates it.
Set up authentication in an ASP.NET Core Web API by installing JWT bearer NuGet packages, configuring JWT settings in appsettings.json, and implementing authentication and token validation in Program.cs.
Enable authorize on the regions controller to require authentication, returning 401 for unauthenticated requests, and require clients to obtain a JWT token with a valid key, issuer, and audience.
Enable identity for the api with user registration and login, configure an auth database, and define reader and writer roles to govern get operations and create, update, and delete actions.
Seed identity roles using OnModelCreating to inject reader and writer roles into the database. Configure two IdentityRole entries with IDs and concurrency stamps, then apply migrations to seed data.
Run ef core migrations to create the identity database by specifying the auth db context, add and update migrations, and verify identity tables and roles in SQL Server.
Set up identity in your ASP.NET Core Web API by configuring identity core, adding roles and token providers, wiring the entity framework stores, and enabling JWT authentication.
Create an auth controller with a post register method at /api/auth/register, using a register request DTO and UserManager to create an IdentityUser in ASP.NET Core identity and assign roles.
Verify user credentials via a login action method using a post request to /api/auth/login, validating username and password with a login request DTO, and prepare a token for valid users.
Create a JWT token in ASP.NET Core by moving token creation to a repository, building email and role claims, and signing with app settings keys for a 15-minute expiry.
Inject the ITokenRepository into the app and controller to create a JWT token from the user and roles, then test via Postman using the bearer token to access protected regions.
Implement role-based authorization in ASP.NET Core Web API by securing actions with reader and writer roles and testing access with JWT tokens.
Learn how to add JWT bearer authorization to Swagger, configure security definitions and header authentication, and test protected endpoints.
Learn to upload images through an asp.net core web api, validate extensions and size, store files locally, save image data in a database, and return the image path.
Create an image domain model with id, i form file (not mapped), file name, description, extension, size, and file path; then update the DbContext and run EF Core migrations.
Add a DbSet of type image named images to the networks dbcontext, then run entity framework core migrations and update the database to create the images table.
Create an image upload controller with a post method at api/images/upload, using an image upload DTO, validating extension and size, and saving the file and record via a repository.
Implement a local image repository to upload images via the ASP.NET Core Web API, convert the DTO to a domain model, and save the image and URL to the database.
Enable static files serving in asp.net core by configuring UseStaticFiles with a physical file provider and the /images path, so uploaded images in the images folder become accessible via /images.
Implement logging in our ASP.NET Core Web API using Serilog, a third-party library, to capture and store runtime information and insights into application behavior.
install Serilog packages, configure Serilog in Program.cs, inject the logger into the Regions controller, and log information, debug, warnings, errors, and exceptions to the console.
Log to a text file in an ASP.NET Core Web API using Serilog sinks, configure Program.cs to log to console and file in a logs folder with rolling intervals.
Implement a global exception handling middleware in an ASP.NET Core Web API to return a consistent 500 JSON error response, log the error, and include a unique error id.
*** NEW RECORDED VERSION on .NET 10 COMING SOON ***
THIS COURSE HAS BEEN UPDATED TO THE LATEST VERSION [.NET8]
The course is compatible with both versions - .NET7 & .NET8
This is a complete guide to creating ASP.NET Core Web API using .NET8, Entity Framework Core (EF Core), and SQL Server database.
With over 11000 student enrolments and more than 2000 5-star reviews, this course has helped students from all backgrounds to learn and implement ASP.NET core Web API.
This course is for all skill levels and best suits beginners and intermediate developers who have gained knowledge in C# and ASP.NET Web MVC and want to use their skills to learn ASP.NET Core and specifically ASP.NET Core Web API.
In this ASP.NET Core WEB API course, we will use .NET8 and create a REST WEB API.
During this course, you will gain so much experience creating ASP.NET Core APIs and endpoints and by the end, I am confident that you will gain enough practical knowledge to create your own ASP.NET Web APIs.
We will create a very engaging Web API in which we will create the regions and walks of New Zealand and we will create an ASP.NET Core Web API so that clients of this API can consume this data.
We will start with learning what are the principles of REST and understand the files that ASP.NET Core creates as part of a new project.
Then we will create and understand our domain and domain models.
Then we will go ahead and install Entity Framework Core and using EF Core migrations we will create our SQL Server Database.
We will then create controllers for our API and test them using Swagger UI.
We will also understand and implement the concepts of Domain and Data models and use clean coding techniques to build our ASP.NET CORE Web API.
We will use a famous third-party library called Automapper to map objects inside our API.
With all of this, we will go on and create CRUD operations for our Web API. We will perform Create, Read, Update, and Delete operations on our API using the Repository Pattern in ASP.NET Core API.
Then we will understand and implement Authentication and Authorization in ASP.NET CORE Web APIS using JWT tokens and see how we can generate JWT tokens using our API (Server) so that we can Authenticate and Authorize the clients of our application.
We will learn more advanced level stuff by implementing Filtering, Sorting, and Pagination in our ASP.NET Core Web API.
We will use Postman and Swagger to test our Authentication and Authorization.
We will also use ASP.NET Core Identity in our API where we Register users and assign roles to them.
In this course ASP.NET Core Web API course, you will learn and implement:
Understand REST APIs by creating a Web API using ASP.NET Core and .NET 7
Understand REST Principles
Understand Dependency Injection and Benefits
Creating New ASP.NET Core Web API Project
Understand .NET8 WEB API Project In .NET 8 and C#
Learn And Install Entity Framework Core (EF Core) In ASP.NET Core Web API Project
Learn Entity Framework Core Migrations
Understand the difference between Domain models and DTOs
Understand Domain Models and Repository Pattern
Use Swagger To Test ASPNET Core WEB API project
Learn How To Map Models To One Another Using Automapper
Learn Asynchronous Programming (Async Await)
Validate ASP.NET Core WEB API
Secure your ASP.NET Core Web API using Microsoft Identity by adding Authentication and Role-Based Authorization to your REST API.
Add JWT Authentication to ASP.NET Core Web API by creating JWT Tokens for API Clients.
Understand and Add Authentication and Authorization To ASP.NET Core API and Create Read and Write Users To Test this Via Postman
Incorporate ASP.NET JWT Authentication Into SwaggerUI
Add advanced functionality like Filtering, Sorting, and Pagination to your ASP.NET Core Web API.
Know me more
I am Sameer, a professional software developer with over 15 years of industry experience. I love to educate myself and others and that's why I started with my YouTube channel where I have a loving audience. I create content for software developers like you so that I can share my knowledge.
Statistics
Over 27000 students on Udemy
Over 4000 Reviews on Udemy
Over 2.4 Million Views on YouTube
Some of the reviews
Hands down the best way to learn this technology stack. Sameer did a good job here and I hope he will be blessing us with more interesting Angular projects in the future! Maybe a sample e-commerce or Hotel Booking app :)
Although I didn't have any prior experience with C# OR .Net Core MVC, I was still able to grasp a lot from this course, all thanks to the instructor!
A very detailed and extensive course! clear voice and great detail to topics.
and 1000s of more reviews on my courses.
Money Back Guarantee
I Guarantee you that after finishing this course, you will be confident enough to create REST APIs in ASP.NET Core and .NET8 on your own.
You will feel confident at work or when creating your projects.
If you want to create functional, generic, clean, and usable websites using ASP.NET, then this is the course for you.
If still, you are unable to get benefit from this course (we will be sad to see you go!), there is a "30-day money back guaranteed by Udemy".
Why do you need this course?
By buying this course, you will make a fantastic choice as this course will help you gain the confidence you need to create ASP.NET Core Web APIs
I assure you that by the end of this course, you will have the confidence to create scalable ASP.NET Core Web APIs from scratch.