Hey guys in this tutorial we are going to create a simple asp.net core web api migrating to data base. and making some crud operation.
Create a new project > Asp.netcorewebApp>WebApplication4(Anyname) >SelectApi>
At first check your project is running or not.
Create a new Folder Naming it as Models>create a class(TicketClass)
Create a TicketContextClass inside model Folder Name it as TicketContext.cs
//here DbContext inherits from using Microsoft.EntityFrameworkCore;
//This TicketItems will take all the contents from the database so of course we need to tell data base to get connection :
so lets go to Startup.cs
If you don’t know how to access the GetConnectionString then you can store it on in memory database see this
Now we are all ready to store it on db.If using in memory db you don’t need to perform this steps:
Now it’s time to Create a TicketController.cs inside TicketController Folder.
Insert This code to create read update and delete.
now it’s time to use postman before that you have to disable ssl certificate option inside your project properties.
Hit this url for
select post>body>raw>select JSON/(application/json)
165 total views, 2 views today