-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdapperCrud.sql
83 lines (50 loc) · 1.7 KB
/
dapperCrud.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
Create Procedure InsertCustomer(@FirstName nchar(50)
,@LastName nchar(50)
,@Id_Card_No nvarchar(11)
,@Mobile_No nvarchar(11)
,@Home_Address nvarchar(max)
,@Business_Address nvarchar(max)
,@City nvarchar(max)
,@Email nvarchar(max))
as
begin
INSERT INTO [dbo].[Customers]
([FirstName]
,[LastName]
,[Id_Card_No]
,[Mobile_No]
,[Home_Address]
,[Business_Address]
,[City]
,[Email])
VALUES (@FirstName,@LastName,@Id_Card_No,@Mobile_No,@Home_Address,@Business_Address,@City,@Email)
end
create proc GetAllCustomers
as begin
select * from Customers end
create proc DeleteCustomer(@Id int)
as begin
delete from Customers where Id = @Id
end
create proc GetByIdCard(@Idcardno nvarchar(11))
as begin
select * from Customers where Id_Card_No = @Idcardno end
create proc UpdateCustomer (@FirstName nchar(50)
,@LastName nchar(50)
,@Id_Card_No nvarchar(11)
,@Mobile_No nvarchar(11)
,@Home_Address nvarchar(max)
,@Business_Address nvarchar(max)
,@City nvarchar(max)
,@Email nvarchar(max))
as begin
Update Customers set FirstName = @FirstName,
LastName = @LastName,
Id_Card_No = @Id_Card_No ,
Mobile_No = @Mobile_No,
Home_Address = @Home_Address,
Business_Address = @Business_Address,
City = @City,
Email = @Email
where Id_Card_No = @Id_Card_No
end