ASP.NET Core WEB API: Session 1
In this session, we will Learn how to create Simple basic Core WEB APIs for SAP Business one using C# Language.
STEP 1: First of all, open Visual Studio. As you can see, I have installed Latest Version visual studio 2022, we will get this first screen.
STEP 2: Click on Create a new project button, It will Open, Create a new Project window as bellow.
STEP 3:
We are creating ASP.NET Core Web API using C#, you can also search in Search Box.
Select ASP.NET Core Web API and click Next Button. It will open Configure your new Project screen as bellow.
STEP 4:
Set Project Name as "ASPCoreWebAPICRUD" and select location where you want to save this project. Then Click NEXT button.
It will open "Additional Information" Screen as below. Here "Configure for HTTPS", "Enable OpenAPI Support", "Use Controllers" checkbox must be checked. Now Click on "Create" button.
It will open project with below screen, we still have done nothing, just created a project
STEP 5:
Now add new API controller in our project. Right Click on "Controller" folder, then on click on "Add", and then click on "Controller..".
It will open popup "Add new Scaffolded Item" as below, Now select "API Controller - Empty" and click "Add" button.
It will open popup as below, where you can give name of the API controller. Set "StudentAPIController.cs" name and click "Add" button.
STEP 6:
Now we need to add 3 packages "Microsoft.EntityFrameworkCore.SqlServer", "Microsoft.EntityFrameworkCore.Tools" and "Microsoft.EntityFrameworkCore.Design"
Right Click on "Dependencies"->"Packages"->"Manage NuGate Packages"
It will open window from where we can install packages. Now first of all click on "Browse" Tab. Then search "Microsoft.EntityFrameworkCore.SqlServer" first package. Once you will get it, select it. You will get another window left side. from where you can select version and install it.
We are using .NET 8.0 version so slect Latest patch of 8.0 version from the dropdown, then click "Install" button.
Once you will click on install button, you will get window to Accept licence. Now click on "I Accept" button.
Same way Install "Microsoft.EntityFrameworkCore.Tools" package. Search "Microsoft.EntityFrameworkCore.Tools" package. Once you will get it, select it. You will get another window left side. from where you can select version and install it.
We are using .NET 8.0 version so slect Latest patch of 8.0 version from the dropdown, then click "Install" button.
Once you will click on install button, you will get window to Accept licence. Now click on "I Accept" button.
Same way Install "Microsoft.EntityFrameworkCore.Design" package. Search "Microsoft.EntityFrameworkCore.Design" package. Once you will get it, select it. You will get another window left side. from where you can select version and install it.
We are using .NET 8.0 version so slect Latest patch of 8.0 version from the dropdown, then click "Install" button.
Once you will click on install button, you will get window to Accept licence. Now click on "I Accept" button.
To verify that all packages are installed properly, go to Dependencies -> Packages. You will get all install packages as below.