public static void Update(teacherModel teacher) { 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 <teacherModel>("update teachers set fname=(@fname), lname=(@lname), expertise=(@expertise), age=(@age), dateOfHire=(@dateOfHire) where TeacherId=(@TeacherId)", teacher); } }
public static void CreateNew(teacherModel teacher) { 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 <teacherModel>("insert into teachers (fname, lname, expertise, age, dateOfHire) values(@fname, @lname, @expertise, @age, @dateOfHire)", teacher); } }