LinqLayer1.gif

Step 1: (Back End)

When developing an application, first we prepare a database.

Create Databse:

Create dataBase LINQ_WithThreeLayer
use LINQ_WithThreeLayer
Create table:

create table tbl_Registration
(
Reg_Id int IDENTITY(1,1) primary key,
First_Name varchar(50) NULL,
Last_Name varchar(50) NULL,
UserName varchar(50) NULL,
Password varchar(50) NULL,
)

Create stored Procedure:

Create Proc [dbo].[SP_Registration]
(
@FName varchar(50),
@LName varchar(50),
@UName Varchar(50),
@Password varchar(50)
)
As
Begin
declare
@Result int
if not exists(select UserName from tbl_Registration where UserName=@UName)
begin
insert into tbl_Registration(First_Name,Last_Name,UserName,Password)
values(@FName,@LName,@UName,@Password)
set @Result=1
return @Result
end
else
begin
set @Result=0
return @Result
end
End

Step 2: (Front End)

LinqLayer2.gif

Data Access Layer:

Business Access Layer:

Presentation Layer: