ASP.NET Core 6 Web API CRUD operations in Azure SQL Server
1. Create Azure Web APP (check this video https://www.youtube.com/watch?v=f7folUXimUs)
2. Create Azure SQL Server and populate data with SQL management studio.
3. Create Asp.net core web api using entity framework and Scaffolding
4. Deploying and testing the web api in Azure Web App
Resources:
PM command line:
Scaffold-DbContext “Server={server name}; Database={database name}; User ID={user name}, Password={password}; Trusted_Connection=False;Encrypt=True;” Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
T-SQL:
CREATE TABLE Employees
(
ID int primary key identity,
FirstName nvarchar(50),
LastName nvarchar(50),
Gender nvarchar(50),
Salary int
)
GO
INSERT INTO Employees VALUES (‘Pranaya’, ‘Rout’, ‘Male’, 60000)
INSERT INTO Employees VALUES (‘Anurag’, ‘Mohanty’, ‘Male’, 45000)
INSERT INTO Employees VALUES (‘Preety’, ‘Tiwari’, ‘Female’, 45000)
INSERT INTO Employees VALUES (‘Sambit’, ‘Mohanty’, ‘Male’, 70000)
INSERT INTO Employees VALUES (‘Shushanta’, ‘Jena’, ‘Male’, 45000)
INSERT INTO Employees VALUES (‘Priyanka’, ‘Dewangan’, ‘Female’, 30000)
INSERT INTO Employees VALUES (‘Sandeep’, ‘Kiran’, ‘Male’, 45000)
INSERT INTO Employees VALUES(‘Shudhansshu’, ‘Nayak’, ‘Male’, 30000)
INSERT INTO Employees VALUES (‘Hina’, ‘Sharma’, ‘Female’, 35000)
INSERT INTO Employees VALUES (‘Preetiranjan’, ‘Sahoo’, ‘Male’, 80000)
GO
select * from Employees
Comments are closed.