public async Task UpdateAsync(User employee) { sqlCmd.CommandText = "Update Users set Id=@Id, FirstName=@FirstName where LastName=@LastName;"; sqlCmd.Connection = myConnection; sqlCmd.Parameters.AddWithValue("@Id", employee.Id); sqlCmd.Parameters.AddWithValue("@FirstName", employee.FirstName); sqlCmd.Parameters.AddWithValue("@LastName", employee.LastName); await SQLExecutor.ExecuteAsync(myConnection, sqlCmd); }
public async Task AddAsync(User user) { sqlCmd.CommandText = "INSERT INTO Users (Id,FirstName,LastName) Values (@Id,@FirstName,@LastName)"; sqlCmd.Connection = myConnection; sqlCmd.Parameters.AddWithValue("@Id", user.Id); sqlCmd.Parameters.AddWithValue("@FirstName", user.FirstName); sqlCmd.Parameters.AddWithValue("@LastName", user.LastName); await SQLExecutor.ExecuteAsync(myConnection, sqlCmd); }
public async Task DeleteAsync(int id) { sqlCmd.Connection = myConnection; sqlCmd.CommandText = "delete from Users where Id=" + id + ""; await SQLExecutor.ExecuteAsync(myConnection, sqlCmd); }