
Learn to build a fully functional ASP.NET Core web API with Entity Framework, implement CRUD with data validation, authenticate users, document with Swagger, and deploy to Azure.
Learn how HTTP enables client-server communication on the web, with requests (methods, headers, bodies) and responses (status, headers, body), and how get, post, put, and patch drive stateless APIs.
Explore REST as an architectural style for building RESTful web services, emphasizing stateless operations, client-server separation, a unified interface, data independence, layering, caching, and language-agnostic deployment with .NET.
Define rest endpoints under /api/meetup to list, create, and update meetups using get, post, and put, with /api/meetup/{id}/lectures for their lectures and query strings for city, sort, and format.
Install and verify the dotnet sdk, create a new asp.net core web api project in visual studio, and review the weather forecast controller and route.
Video for linux/macOS users explaining the necessary commands and tools to be able to follow along during the course.
Commands and tools are listed in the resource 'linux & macOS Resources.txt'
Discover how the startup class shapes an ASP.NET Core API by configuring services for dependency injection and building the request pipeline with middleware, illustrated by a hello world example.
Master dependency injection as a design pattern that decouples components by programming against interfaces, enabling plugin architecture, flexible service wiring, and testability in .NET Core.
Explore building a meetup-focused ASP.NET Core API using ORM with Entity Framework Core to generate a database schema from code, featuring one-to-one meetup location and one-to-many lectures, installed via NuGet.
Create and map three entity classes Location, Lecture, and Meetup in an IT Entities catalog, leveraging Entity Framework conventions to auto-generate primary keys and define relationships.
Create a meetup context class inheriting from DbContext, expose DbSet properties for meetups, locations, and lectures, configure relationships, and define a SQL Server connection with a local Mytab DB.
Create a migration in entity framework core with add migration init to generate migrations folder, model snapshot, and migration file, update-database builds Meetup DB with tables and relationships.
Seed an ASP.NET Core API database by creating a seeder class, checking connectivity and empty meetups table, inserting sample meetups, saving changes, and registering the context for dependency injection.
Use Postman as an http client to test an ASP.NET Core API by sending requests with verbs, headers, and a body, and adjust SSL certificate verification and two point view.
Create the first ASP.NET Core API controller, map http get and post actions with route, query, and body bindings to serve weather data, and test with Postman.
Create a meetup controller in the ASP.NET Core API, inject the meetup context via the constructor, route to /api/meetup, and expose a GET method returning meetups from the database.
Understand http status codes from 100 informational to 500 server errors, including 300 redirection, and implement returns in an ASP.NET Core controller using HttpContext.Response.StatusCode, StatusCode, or NotFound, with default 200.
Create a get-by-name endpoint that returns a single meetup details DTO by name, handling spaces by replacing with dashes and lowercase; returns 404 if not found, 200 with mapped DTO.
Create a post method in the meetup controller that accepts model from the body, maps it to an entity with AutoMapper, saves with Entity Framework, and returns 201 with location.
Introduce model validation in the ASP.NET Core API by applying [Required] and [MinLength(3)] to the meetup name, enforce it in POST, and return 400 on errors or 201 on success.
Master the meetup modification flow by implementing an http put method to edit meetups, validate models, update fields, save changes, and verify via Postman.
Implement a delete endpoint in the meetup controller using http delete with the name parameter, verify existence, remove the meetup via meetup context with entity framework, and return no content.
Create sub-resources under a meetup by adding a lecture through a dedicated lectures controller, using api/meetup/{name}/lecture, with model validation, Automapper mapping, and database persistence.
Fetch sub-resources by including lectures in the meetup details and by adding a dedicated endpoint to retrieve lectures for a specific meetup, demonstrated via mapping and Postman tests.
Learn how to delete all lectures for a meetup or a single lecture using http delete, remove range, and precise checks for not found, with no content responses.
Configure NLog in an ASP.NET Core API by adding the NuGet package and NLog.config, set a file target and rules, inject the logger, and log deletions for a meetup.
Learn to generate automatic API documentation with Swagger for an API with eight endpoints. Configure Swashbuckle in Startup.cs, enable Swagger UI, and test endpoints.
Define authentication and its role in securing an api; cover the three categories and two-factor authentication, and prepare user tables with registration and password hashing.
Add user and role entities to enable email authentication with hashed passwords, link users to roles via a foreign key, and seed initial roles.
Create an account controller with a post register action that binds a register model from the body, validates input, and saves a new user with a default role.
Learn how to securely store user passwords using password hashing in ASP.NET Core, leveraging the built-in password hasher and dependency injection to protect against data breaches.
Refactor data validation using FluentValidation to enforce unique email, required fields, password length, and password confirmation, centralizing rules in a register user validator and wiring it in startup.
Enable secure user authentication with JWT tokens by hashing passwords, creating and validating tokens with claims, signing keys, and configuring bearer authentication in ASP.NET Core.
Create a login action that validates credentials, generates a JWT token with id, role, username, date of birth, and nationality claims, and returns it via a JWT provider.
Learn how to authorize api actions with JWT claims, roles, and policies in ASP.NET Core, applying authorize and allow anonymous attributes at action or controller level, and testing with tokens.
Apply role based authorization in a dotnet core api using the authorized attribute with moderator and admin roles, validating jwt tokens and standard role claims.
Learn to implement claim-based authorization in dotnet core by adding optional nationality claims, registering a 'has nationality' policy, and enforcing it on API actions using the authorize attribute.
This lecture demonstrates a custom authorization policy in ASP.NET Core using a minimum age requirement and a handler that checks a date of birth claim to enforce at least 18.
Implement resource based authorization in ASP.NET Core by creating a resource operation requirement and handler that allows create and read, and restricts update or delete to the resource creator.
Explore the five ASP.NET Core filters—authorization, resource, action, exception, and result filters—and learn how to use action filters for metrics, exception filters for global errors, and authorization filters for security.
Implement a time-tracking action filter in ASP.NET Core by starting a stopwatch before action execution and stopping after, logging the action name and execution time via an attribute.
Apply a global exception filter in an ASP.NET Core API to log errors and return a generic 500 JSON response, so clients see only a simple error message.
Create a custom authorization filter by implementing IAuthorizationFilter to check the nationality claim before actions. Apply NationalityFilter to actions to allow German or Russian nationalities; return 403 when unauthorized.
Apply the service filter attribute to inject dependencies into the time track filter, apply it at the controller level, and register it in the dependency injection container with dedicated logging.
Explore cross-origin resource sharing in asp.net core, showing how browsers block cross-domain requests and how to implement a cors policy to allow localhost:3000.
Learn to serve static files in an ASP.NET Core API using the Microsoft.AspNetCore.StaticFiles package and middleware, configure public and authorized access, and return files with proper content types.
Enable response caching with cache-control and vary-by-request-keys to cache the get file response for private file.txt, reducing server processing.
Design functional actions to reload configuration at runtime, independent of resources. Implement a config controller with a reload action using http options and cast to configuration root type.
The .NET Core platform is the latest tool from Microsoft enabling the creation of cross-platform applications, including web and web APIs.
Due to its high performance, open-source code, and the possibility of implementation on various systems, it is becoming more and more popular.
The course presents how using ASP.NET Core a web API application is created, which ultimately can be consumed by SPA (single page application), mobile applications, IoT applications, or any application where communication takes place via the HTTP protocol. First of all, the course will show you how to build applications in accordance with the REST architecture. Good practices will be discussed, such as dependency injection, auto-mapping, error logging, model validation, use of object-relational mapping.
During the course you will:
- create an application that according to the REST architecture will: read, create, modify or delete data from the server
- send database queries from code using ORM (Entity Framework Core)
- create an MS SQL database based on classes in C #
- validate incoming models and return appropriate messages in case of incorrectness
- use the auto-mapper
- use the built-in container to inject dependencies
- log errors or specific information to a text file
- create documentation (using the Swagger tool)
- configure NLogger
- use the Postman to consume the web API
- authenticate users via JWT tokens
- create your own authorization policies
- create a user and role entities tables
- hash users passwords
- authorize based on users claim and its value