diff options
author | Aryadev Chavali <aryadevchavali1@gmail.com> | 2019-02-10 15:34:18 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadevchavali1@gmail.com> | 2019-02-10 15:35:25 +0000 |
commit | 7beffadae9179095b39eff36a708e3d508ee21fd (patch) | |
tree | 07015ea19925e8b215de4f722e89b2a4ae8ece41 /Database/Database.cs | |
parent | 746bb8ec206dded54f525bda5faa429d456adcb6 (diff) | |
download | newsaggregator-7beffadae9179095b39eff36a708e3d508ee21fd.tar.gz newsaggregator-7beffadae9179095b39eff36a708e3d508ee21fd.tar.bz2 newsaggregator-7beffadae9179095b39eff36a708e3d508ee21fd.zip |
Made return for InsertArticles records written
Diffstat (limited to 'Database/Database.cs')
-rw-r--r-- | Database/Database.cs | 6 |
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 } } |