Latest: https://youtu.be/LyVZySzKoI8 (Unit Testing Blazor ASP.NET 5) Welcome to this fourth episode of the Built a Web Api in ASP.NET Core 3.1 and Consume it using an MVC Client also in ASP.NET Core.

ASP.NET Core, developed by Microsoft, is the latest version of ASP.NET. It is an open-source framework for developing web applications. It is a cross-platform, high-performance, open-source framework for building modern, cloud-based, internet-connected applications. In this video, I have explained how to build an ASP.NET Core 3.1 Web API and Consume with MVC. This video is the fourth episode of the series.

In my previous (third) episode, I discussed the table structure for the database for this project. I will build the project from scratch and walk you through the code explaining everything in the process. All the episodes will be in continuation from the previous ones, so it is highly recommended to be up to date with all the previous episodes before viewing this one.

Watch Part 3: https://youtu.be/q2jWdhtonEM
Watch Part 2: https://youtu.be/loK_gzjngl0
Watch Part 1: https://youtu.be/1iWkl3UIpG0

In this tutorial, I will explain the stored procedures for the CRUD operation

The finished project will use client and server-side form validation techniques used in asp.net core by the MVC client. The Web API project will use Serilog for logging errors.

Like || Share || Spread || Love

Make sure you subscribe to our YouTube Channel and never miss our latest video:- http://bit.ly/Kaushik-roy-chowdhury-subscribe

SQL Scripts:

USE [WebAPIDb]
GO
CREATE PROCEDURE [dbo].[spSelectCustomer]
AS
BEGIN
SELECT [Id]
,[Name]
,[Address]
,[Telephone]
,[Email]
FROM [dbo].[Customer]
END
GO
CREATE PROCEDURE [dbo].[spSelectCustomerById]
@Id int
AS
BEGIN
SELECT [Id]
,[Name]
,[Address]
,[Telephone]
,[Email]
FROM [dbo].[Customer]
WHERE [Id] = @Id

END
GO
CREATE PROCEDURE [dbo].[spInsertIntoCustomer]
@Name nvarchar(50),
@Address nvarchar(MAX),
@Telephone nvarchar(50),
@Email nvarchar(50)
AS
BEGIN
– SET NOCOUNT ON added to prevent extra result sets from
– interfering with SELECT statements.
SET NOCOUNT ON;
INSERT INTO [dbo].[Customer]
([Name]
,[Address]
, [Telephone]
,[Email])
VALUES
(@Name,@Address, @Telephone, @Email)
END
GO
CREATE PROCEDURE [dbo].[spUpdateCustomer]
@Id int,
@Name nvarchar(50),
@Address nvarchar(MAX),
@Telephone nvarchar(50),
@Email nvarchar(50)
AS
BEGIN
UPDATE [dbo].[Customer]
SET [Name] = @Name
,[Address] = @Address
,[Telephone] = @Telephone
,[Email] = @Email
WHERE [Id] = @Id

END
GO
CREATE PROCEDURE [dbo].[spDeleteCustomer]
@Id int
AS
BEGIN
DELETE FROM [dbo].[Customer]
WHERE [Id] = @Id

END
GO
CREATE PROCEDURE [dbo].[spSelectOrder]
AS
BEGIN
SELECT [Id]
,[CustomerId]
,[Description]
,[OrderCost]
FROM [dbo].[Order]
END
GO
CREATE PROCEDURE [dbo].[spSelectOrderById]
@Id int
AS
BEGIN
SELECT [Id]
,[CustomerId]
,[Description]
,[OrderCost]
FROM [dbo].[Order]
WHERE [Id] = @Id

END
GO
CREATE PROCEDURE [dbo].[spInsertIntoOrder]
@CustomerId int,
@Description nvarchar(MAX),
@OrderCost money
AS
BEGIN
INSERT INTO [dbo].[Order]
([CustomerId],[Description],[OrderCost])
VALUES
(@CustomerId,@Description,@OrderCost)
END
GO
CREATE PROCEDURE [dbo].[spUpdateOrder]
@Id int,
@CustomerId int,
@Description nvarchar(MAX),
@OrderCost money
AS
BEGIN
SET NOCOUNT ON;
UPDATE [dbo].[Order]
SET [CustomerId] = @CustomerId,
[Description] = @Description,
[OrderCost] = @OrderCost
WHERE [Id] = @Id

END
GO

CREATE PROCEDURE [dbo].[spDeleteOrder]
@Id int
AS
BEGIN
DELETE FROM [dbo].[Order]
WHERE [Id] = @Id

END
GO

For more updates Follow us on:-

Visit- https://kaushikroychowdhury.com

Facebook- https://www.facebook.com/deveducate

Twitter- https://twitter.com/krchome58

Linkedin- https://www.linkedin.com/in/chowdhurykaushik

Github- https://github.com/krchome

#KaushikRoyChowdhaury #AspNetTutorials #WebAPITutorials #MVC
GitHub Source Code: https://github.com/krchome/WebAPICoreMVCClient
Source Code (ver ASP.NET 5.0): https://github.com/krchome/WebAPIWithMVCClient-Ver5.0 https://www.skillshare.com/r/profile/Kaushik-Roy-Chowdhury/5724896

#kaushikroychowdhaury #aspnettutorials #webapitutorials #mvc #dotnet

Build an ASP.NET Core 3.1 Web API and MVC (Understanding the Stored Procs.) - [Part 4]
1.05 GEEK