public Int32 DeleteContact(Guid ownerId, Guid userId) { s_log.LogInfo($@"Data provider's method '{nameof(DeleteContact)}({ownerId}, {userId})' is called"); #region SQL Query var sqlQuery = @" DELETE FROM contactsLists WHERE OwnerId = @OwnerId AND UserId = @UserId "; #endregion using (IDbConnection connection = new SqlConnection(_dbSettings.DbConnectionString)) { using (CDbTransactionQueryExecutor executor = new CDbTransactionQueryExecutor(connection)) { try { var result = executor.DeleteItem(sqlQuery, SSqlParameterCreator.Create( "@OwnerId", ownerId, System.Data.SqlDbType.UniqueIdentifier, false ), SSqlParameterCreator.Create( "@UserId", userId, System.Data.SqlDbType.UniqueIdentifier, false ) ); executor.Commit(); return(result); } catch (SqlException e) { s_log.LogError($@"{nameof(DeleteContact)}({ownerId}, {userId}): Error occured during SQL query execution", e); s_log.LogInfo($@"{nameof(DeleteContact)}({ownerId}, {userId}): Operation was rolled back because of error"); Console.WriteLine($@"{nameof(DeleteContact)}({ownerId}, {userId}): Error occured during SQL query execution"); Console.WriteLine("Operation was rolled back because of error"); return(0); } } } }