Skip to content

Commit aa56659

Browse files
authored
Merge pull request #448 from TechnologyEnhancedLearning/RC
merge Taurus changes to master
2 parents e1f17e2 + 5017fc0 commit aa56659

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

WebAPI/LearningHub.Nhs.Repository/Resources/BlockCollectionRepository.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,22 @@ public async Task DeleteBlockCollection(int userId, int blockCollectionId)
8383

8484
foreach (var id in collectionIds)
8585
{
86-
using (var lhContext = new LearningHubDbContext(this.DbContext.Options))
86+
_ = Task.Run(async () =>
8787
{
88-
_ = lhContext.Database.ExecuteSqlRawAsync("resources.BlockCollectionDelete @p0", new SqlParameter("@p0", SqlDbType.Int) { Value = id });
89-
}
88+
var lhContext = new LearningHubDbContext(this.DbContext.Options);
89+
try
90+
{
91+
await lhContext.Database.ExecuteSqlRawAsync("resources.BlockCollectionDelete @p0", new SqlParameter("@p0", SqlDbType.Int) { Value = id });
92+
}
93+
catch (Exception ex)
94+
{
95+
throw new Exception(ex.Message);
96+
}
97+
finally
98+
{
99+
await lhContext.DisposeAsync();
100+
}
101+
});
90102
}
91103
}
92104

0 commit comments

Comments
 (0)