public static void Update(studentModel student) { 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 <studentModel>("update students set fname=(@fname), lname=(@lname), dateOfEnrollment=(@dateOfEnrollment), age=(@age), grade=(@grade), GPA=(@GPA) where StudentId=(@StudentId)", student); } }
public static void CreateNew(studentModel student) { 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 <studentModel>("insert into students (fname, lname, dateOfEnrollment, age, grade, GPA) values(@fname, @lname, @dateOfEnrollment, @age, @grade, @GPA)", student); } }