
Build a .NET 5 web API with Visual Studio, code-first migrations, and entity framework to persist data in SQL Server. Learn MVC, CRUD operations, and basic git workflows.
Call a .NET 5 web api that returns random weather data for next days and test it with Chrome DevTools and Postman, while running with dotnet watch for autorestart.
Initialize a git repository in Visual Studio by adding to source control and selecting Git, with options for GitHub or local repositories, and track changes via the gits tab.
Introduce the mvc pattern as the foundation and prepare to build a dotnet five web api by creating a contacts controller and model to implement crud operations.
Explore how the model, view, and controller interact in mvc pattern: the model stores data, the view presents it, and the controller performs create, update, and delete operations.
Create an API controller with read-write actions, derive from controller base, and enable API routing; return a mock contact list via a get method.
Discover how http methods map to crud operations in practice, focusing on get, post, put, and delete, including soft delete and code generation from entity framework.
Explore how the Http get attribute routes a single contact by id, using route parameters, a lambda with first or default, and returning the contact or 204 no content.
Use IActionResult to return http status codes such as 200 and 404, wrap a contact in the result, and provide a custom message when an id is not found.
Learn how http post and the from body attribute bind a contact object from the request body, then return the updated list and test with Postman using a json body.
Learn how to implement a put update in a .NET 5 Web API, updating a contact by id with body data, handling not found, and returning the updated list.
Implement the delete call by using the http delete attribute and returning an action result to display the updated contact list, handling not found cases for invalid IDs.
Master the model-view-controller pattern and http request methods for crud, create your first model and controller, then transition to persisting data with entity framework in dotnet five.
Connect your web API to a database table and persist data using Entity Framework with CRUD operations, using Code First migrations on SQL Server Express and asynchronous service calls.
Explore how object-relational mapping connects models to relational databases using Entity Framework, and learn how code-first migration creates and updates tables and relations.
Install the preview of Entity Framework Core with the dotnet CLI, including global tool installation, exact version, and core SQL Server and design packages, then restart Visual Studio if needed.
Add the initial create migration with dotnet ef migrations add initial create, then run dotnet ef database update to create the contacts table.
Build get implementations in a .NET 5 web api with entity framework and dependency injection, using the data context and dbset to fetch contacts asynchronously and test with postman.
Demonstrate creating new contacts via post requests, adding entries to the contacts table, saving changes for a 201 created response, and retrieving all contacts from the data context.
Use a PUT to update a contact by including the id in the URL and body, mark the entry as modified, and save changes, returning 204 or 404 as appropriate.
Find the contact by id, return not found if absent, remove the entry with entity framework, save changes, and present the list; implement a soft delete with the isdeleted flag.
Welcome to the "ASP.NET Web API 2 Hands-On" course and thank you very much for signing up!
In this short introduction, you will see what you're going to learn in this course. Have fun!
When you want to create a Web Service with Web API 2, you may find yourself in two different situations. You either want to build a new Web Application from scratch and use Web API 2 with that application, or you already have build a Web Application and add Web API 2 afterwards. In this lecture, we cover the first situation.
In this lecture, you will learn how to add Web API 2 to an already built Web Application in Visual Studio.
Web API uses the Model-View-Controller pattern. In this lecture, you will learn what this pattern actually means, and you will create your first model class in C#.
The controller implements the actual logic to a corresponding model. You learn to build your first controller in this lecture.
We want to use our new web service within a simple website. So we're going to add a new HTML page and install JQuery through the NuGet Package Manager to prepare our web application for the first web service call.
You will make your first GET HTTP Request with JQuery and Web API 2.
What does actually happen when you're calling a RESTful web service and why does it work with Web API 2? You'll find the answer in this lecture.
In the last lectures, we received all available objects from the service. Now we only want to get a certain one. Here you will learn to write the server part.
In this lecture we're going to write the client part to get a single object from the service. Instead of $.getJSON(), this time we'll go into a little more detail by using $.ajax().
The first POST HTTP Request. We will create an object with JavaScript and add this object to the object array on the server.
The last two of the four HTTP methods. We will change an object by using a PUT request and remove an object by using DELETE.
So far, we know how to make any kind of HTTP Request with Web API and JQuery. But we only get a particular object by using its ID. What about using another property, e.g. the name? We'll cover this task in this situation.
Web API 2 delivers the so called Attribute Routing. This gives you more control over your API design. You're free to choose any URI for your routes, create a typical RESTful structure and don't have to rely on the routing tables of the first release of Web API anymore.
Attribute Routing is not only about defining custom URIs. In this lecture you will learn how to use prefixes and constraints with this new feature.
You're ready to start creating web applications with Web API 2. Congratulations! The next step is to save your data persistently in a database. Entity Framework enables you to do this. In this lecture, you will learn the first steps of how to use Web API with Entity Framework and look for changes on your objects in the database.
.NET 5 is the future.
It will combine the old .NET framework with .NET Core and that's why it’s about time to update this course with the latest version of .NET.
You will learn the crucial stuff about web development with Web API and Entity Framework in .NET 5 in no time so that you're able to join new projects and companies who are craving for .NET developers like you very soon.
With the example application, we're going to build you will be able to create, read, update, and delete contacts. We will use people you might even know, like Peter Parker or Tony Stark.
The tools we’re going to use are the .NET SDK, of course, together with Visual Studio to write our code, Postman to make our REST calls and SQL Server Express for our database.
Everything is available for free! So you already have everything you need to start developing with .NET 5.
A few minutes into the course, you will already make your first Web API call.
After that you create your own model and controller to make use of the Model-View-Controller pattern and implement all CRUD operations, meaning create, read, update and delete with the corresponding HTTP methods GET, POST, PUT and DELETE.
Then you will make your data persistent with the help of the object-relational mapper Entity Framework and code-first migration.
With all that knowledge, you are ready to conquer any .NET 5 back end application.
What You Will Learn
Introduction
Download & install the .NET 5 SDK, Visual Studio 2019 Community Edition & Postman
Create your first Web API call within the first minutes
Initialize a Git repository for your source control
Web API
The Model-View-Controller (MVC) pattern
Create models and controllers
Attribute routing (with parameters)
All CRUD operations (Create, Read, Update, Delete)
The HTTP request methods GET, POST, PUT & DELETE
Entity Framework
Object-Relational-Mapping
Code-First Migration
SQL Server Express
How to use a DataContext and a proper ConnectionString
All previous HTTP requests with Entity Framework to save your data in a SQL Server database
Your Instructor
My name is Patrick and I will be your instructor in this course. I’m a web developer for over a decade now, I have worked for big corporations and small teams, as an employee and a contractor and I just love to see the way Microsoft is going with .NET and how important it gets day by day.
To this date, I was able to run seven courses on web development here on Udemy about NET Core, single-page applications, Angular, and DevOps with a total of almost 50.000 unique students and more than 4.000 reviews.
If you have any questions, feel free to connect.
And if you still have any doubts, you have a 30-day money-back guarantee, no questions asked.
So, I hope you’re ready for your new skills and your new projects! ;)
I’m looking forward to seeing you in the course!