public int Delete(ExampleDBModel exampleDBModel) { string sql = @"DELETE FROM [dbo].[ExampleDBModel] WHERE [Currently Employed] = @CurrentlyEmployed"; return(ExecuteSql(sql, exampleDBModel)); }
private int ExecuteSql(string sql, ExampleDBModel exampleDBModel) { using (var dbconnection = new SqlConnection(_connectionString)) { dbconnection.Open(); var transaction = dbconnection.BeginTransaction(); try { var response = dbconnection.Execute(sql, exampleDBModel); transaction.Commit(); return(response); } catch { transaction.Rollback(); throw; } } }
public int Insert(ExampleDBModel exampleDBModel) { string sql = @"INSERT INTO [dbo].[ExampleDBModel] ([Name],[DoB],[Office Location],[Currently Employed],[Salary] VALUES (@Name, @DoB @OfficeLocation, @CurrentlyEmployed, @Salary)"; using (var dbconnection = new SqlConnection(_connectionString)) { dbconnection.Open(); var transaction = dbconnection.BeginTransaction(); try { var response = dbconnection.Execute(sql, exampleDBModel); transaction.Commit(); return(response); } catch { transaction.Rollback(); throw; } } }
public int Update(ExampleDBModel exampleDBModel) { return(Update(new SQLQuery <ExampleDBModel>(_updateQuery, exampleDBModel))); }
public int Delete(ExampleDBModel exampleDBModel) { return(Delete(new SQLQuery <ExampleDBModel>(_deleteQuery, exampleDBModel))); }
public int Insert(ExampleDBModel exampleDBModel) { return(Insert(new SQLQuery <ExampleDBModel>(_insertQuery, exampleDBModel))); }