public static void UpdateStaff(staffModel staff) { using (IDbConnection cnn = new SqlConnection("Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=rockBottomHigh_DB;Integrated Security=True;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False")) { cnn.Query <staffModel>("update staff set fname=(@fname), lname=(@lname), age=(@age), dateOfHire=(@dateOfHire), jobTitle=(@jobTitle) where StaffId=(@StaffId)", staff); } }
public static void CreateNewStaff(staffModel staff) { using (IDbConnection cnn = new SqlConnection("Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=rockBottomHigh_DB;Integrated Security=True;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False")) { cnn.Query <staffModel>("insert into staff (fname, lname,age, dateOfHire,jobTitle) values(@fname, @lname, @age, @dateOfHire, @jobTitle)", staff); } }