public void RevertTask(WorkTask workTask) { using (var connection = _database.GetOpenConnection()) using (var transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted)) { var model = workTask.ToModel(false); connection.Update(model, transaction); transaction.Commit(); } }
/// <summary> /// Considers the Task completed and deletes it /// </summary> public void TaskCompleted(WorkTask workTask) { using (var connection = _database.GetOpenConnection()) using (var transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted)) { var model = workTask.ToModel(); var deleted = connection.Execute( string.Format("DELETE FROM {0} WHERE Owner=@owner AND Id=@id AND CheckedOut=1", WorkTaskTable.TableName), new { owner = model.Owner, id = model.Id }, transaction); if (deleted == 0) { Log.Warning( string.Format("Tried to mark a WorkTask (id={0}) as completed when that task didn't exist", model.Id)); } transaction.Commit(); } }