Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions Src/Core/F8/DataAccess/F8Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,33 @@ await _appContext

try
{
var rowsAffected = await _appContext
// Remove list
await _appContext
.Set<TodoTaskListEntity>()
.Where(list => list.Id == listId)
.ExecuteDeleteAsync(ct);

if (rowsAffected == 0)
{
throw new DbUpdateException();
}
// Remove all task steps
await _appContext
.Set<TodoTaskEntity>()
.Where(task => task.TodoTaskListId == listId)
.Select(task => task.Id)
.ForEachAsync(
async taskId =>
{
await _appContext
.Set<TodoTaskStepEntity>()
.Where(taskStep => taskStep.TodoTaskId == taskId)
.ExecuteDeleteAsync(ct);
},
ct
);

// Remove all tasks
await _appContext
.Set<TodoTaskEntity>()
.Where(task => task.TodoTaskListId == listId)
.ExecuteDeleteAsync(ct);

await dbTransaction.CommitAsync(ct);
}
Expand Down
Loading