aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Database/Database.cs6
1 files changed, 3 insertions, 3 deletions
diff --git a/Database/Database.cs b/Database/Database.cs
index 9a78988..d3ccb2e 100644
--- a/Database/Database.cs
+++ b/Database/Database.cs
@@ -23,12 +23,12 @@ namespace Database {
public virtual DbSet<Article> Articles { get; set; }
public virtual DbSet<Config> Configs { get; set; }
- public async void InsertArticles(IEnumerable<Article> articles) {
+ public async Task<int> InsertArticles(IEnumerable<Article> articles) {
try {
await Articles.AddRangeAsync(articles);
- await SaveChangesAsync();
+ return await SaveChangesAsync();
} catch (Microsoft.EntityFrameworkCore.DbUpdateException) {
- return; // duplicate title id's
+ return -1; // duplicate title id's
}
}