Skip to content

Commit ab9ed6a

Browse files
committed
Merge pull request #32 from csantero/more-async
use more async EF methods
2 parents c814108 + ccd41d5 commit ab9ed6a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

JSONAPI.EntityFramework/Http/ApiController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public override async Task<IList<T>> Post(IList<T> postedObjs)
4747
var material = await materializer.MaterializeUpdateAsync(postedObj);
4848
if (context.Entry<T>(material).State == EntityState.Added)
4949
{
50-
context.SaveChanges();
50+
await context.SaveChangesAsync();
5151
materialList.Add(material);
5252
}
5353
else
@@ -71,7 +71,7 @@ public override async Task<IList<T>> Put(string id, IList<T> putObjs)
7171
var material = await materializer.MaterializeUpdateAsync(putObj);
7272
materialList.Add(material);
7373
}
74-
context.SaveChanges();
74+
await context.SaveChangesAsync();
7575
return materialList;
7676
}
7777

@@ -81,7 +81,7 @@ public override async Task Delete(string id)
8181
DbContext context = materializer.DbContext;
8282
T target = await materializer.GetByIdAsync<T>(id);
8383
context.Set<T>().Remove(target);
84-
context.SaveChanges();
84+
await context.SaveChangesAsync();
8585
await base.Delete(id);
8686
}
8787

0 commit comments

Comments
 (0)