Account db read operation

This commit is contained in:
Mikhail Shabanov committed 2020-11-01 14:10:57 +01:00
1 parent 91f69a6e39
commit 1c803585e1
7 files changed
+61 -5

No files matched your search

@@ -1,7 +1,10 @@
namespace WotBlitzStatisticsPro.DataAccess
using System.Threading.Tasks;
using WotBlitzStatisticsPro.DataAccess.Model.Accounts;
namespace WotBlitzStatisticsPro.DataAccess
{
public interface IWargamingAccountDataAccessor
{
Task<AccountInfo> ReadAccountInfo(long accountId);
}
}
@@ -1,4 +1,5 @@
using MongoDB.Driver;
using System.Threading.Tasks;
using MongoDB.Driver;
using WotBlitzStatisticsPro.Common;
using WotBlitzStatisticsPro.DataAccess.Model.Accounts;
@@ -63,6 +64,11 @@ namespace WotBlitzStatisticsPro.DataAccess
.CreateOne(tankInfoHistoryIndexModel);
}
// ToDo: Read account
public async Task<AccountInfo> ReadAccountInfo(long accountId)
{
var account = await _database.GetCollection<AccountInfo>(AccountInfoCollectionName)
.FindAsync(Builders<AccountInfo>.Filter.Where(a => a.AccountId == accountId));
return account.FirstOrDefault();
}
}
}