mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-21 10:27:18 +02:00
Saving accounts To DB
This commit is contained in:
1 parent
31b067e087
commit
ddbf42e7bb
14 files changed
+372
-54
No files matched your search
@@ -1,16 +1,28 @@
|
||||
namespace WotBlitzStatisticsPro.DataAccess.Model.Accounts
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace WotBlitzStatisticsPro.DataAccess.Model.Accounts
|
||||
{
|
||||
public class AccountInfoHistory
|
||||
{
|
||||
public AccountInfoHistory(long accountId, int lastBattleTime)
|
||||
{
|
||||
AccountInfoHistoryId = new AccountInfoHistoryKey(accountId, lastBattleTime);
|
||||
}
|
||||
|
||||
[BsonId]
|
||||
public AccountInfoHistoryKey AccountInfoHistoryId { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Player account identifier
|
||||
///</summary>
|
||||
public long AccountId { get; set; }
|
||||
[BsonIgnore]
|
||||
public long AccountId => AccountInfoHistoryId.AccountId;
|
||||
|
||||
///<summary>
|
||||
/// Last battle time
|
||||
///</summary>
|
||||
public int LastBattleTime { get; set; }
|
||||
[BsonIgnore]
|
||||
public int LastBattleTime => AccountInfoHistoryId.LastBattleTime;
|
||||
|
||||
///<summary>
|
||||
/// Battles count
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
|
||||
namespace WotBlitzStatisticsPro.DataAccess.Model.Accounts
|
||||
{
|
||||
public class AccountInfoHistoryKey : IEquatable<AccountInfoHistoryKey>
|
||||
{
|
||||
public AccountInfoHistoryKey()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public AccountInfoHistoryKey(long accountId, int lastBattleTime)
|
||||
{
|
||||
AccountId = accountId;
|
||||
LastBattleTime = lastBattleTime;
|
||||
}
|
||||
|
||||
public long AccountId { get; set; }
|
||||
|
||||
public int LastBattleTime { get; set; }
|
||||
|
||||
public bool Equals(AccountInfoHistoryKey other)
|
||||
{
|
||||
if (ReferenceEquals(null, other)) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
return AccountId == other.AccountId && LastBattleTime == other.LastBattleTime;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
if (obj.GetType() != this.GetType()) return false;
|
||||
return Equals((AccountInfoHistoryKey) obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(AccountId, LastBattleTime);
|
||||
}
|
||||
|
||||
public static bool operator ==(AccountInfoHistoryKey left, AccountInfoHistoryKey right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(AccountInfoHistoryKey left, AccountInfoHistoryKey right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,34 @@
|
||||
using WotBlitzStatisticsPro.Common.Model;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using WotBlitzStatisticsPro.Common.Model;
|
||||
|
||||
namespace WotBlitzStatisticsPro.DataAccess.Model.Accounts
|
||||
{
|
||||
public class TankInfo
|
||||
{
|
||||
public TankInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TankInfo(long accountId, long tankId)
|
||||
{
|
||||
TankInfoId = new TankInfoKey(accountId, tankId);
|
||||
}
|
||||
|
||||
[BsonId]
|
||||
public TankInfoKey TankInfoId { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Player account identifier
|
||||
///</summary>
|
||||
public long AccountId { get; set; }
|
||||
[BsonIgnore]
|
||||
public long AccountId => TankInfoId.AccountId;
|
||||
|
||||
///<summary>
|
||||
/// Tank identifier
|
||||
///</summary>
|
||||
public long TankId { get; set; }
|
||||
[BsonIgnore]
|
||||
public long TankId => TankInfoId.TankId;
|
||||
|
||||
|
||||
public int BattleLifeTimeInSeconds { get; set; }
|
||||
|
||||
@@ -1,21 +1,40 @@
|
||||
namespace WotBlitzStatisticsPro.DataAccess.Model.Accounts
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace WotBlitzStatisticsPro.DataAccess.Model.Accounts
|
||||
{
|
||||
public class TankInfoHistory
|
||||
{
|
||||
///<summary>
|
||||
/// Player account identifier
|
||||
///</summary>
|
||||
public long AccountId { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Tank identifier
|
||||
///</summary>
|
||||
public long TankId { get; set; }
|
||||
public TankInfoHistory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TankInfoHistory(long accountId, long tankId, int lastBattleTime)
|
||||
{
|
||||
TankInfoHistoryId = new TankInfoHistoryKey(accountId, tankId, lastBattleTime);
|
||||
}
|
||||
|
||||
[BsonId]
|
||||
public TankInfoHistoryKey TankInfoHistoryId { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Player account identifier
|
||||
///</summary>
|
||||
[BsonIgnore]
|
||||
public long AccountId => TankInfoHistoryId.AccountId;
|
||||
|
||||
///<summary>
|
||||
/// Tank identifier
|
||||
///</summary>
|
||||
[BsonIgnore]
|
||||
public long TankId => TankInfoHistoryId.TankId;
|
||||
|
||||
///<summary>
|
||||
/// Last battle
|
||||
///</summary>
|
||||
public int LastBattleTime { get; set; }
|
||||
[BsonIgnore]
|
||||
public int LastBattleTime => TankInfoHistoryId.LastBattleTime;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
|
||||
namespace WotBlitzStatisticsPro.DataAccess.Model.Accounts
|
||||
{
|
||||
public class TankInfoHistoryKey : IEquatable<TankInfoHistoryKey>
|
||||
{
|
||||
public TankInfoHistoryKey()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TankInfoHistoryKey(long accountId, long tankId, int lastBattleTime)
|
||||
{
|
||||
AccountId = accountId;
|
||||
TankId = tankId;
|
||||
LastBattleTime = lastBattleTime;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// Player account identifier
|
||||
///</summary>
|
||||
public long AccountId { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Tank identifier
|
||||
///</summary>
|
||||
public long TankId { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Last battle
|
||||
///</summary>
|
||||
public int LastBattleTime { get; set; }
|
||||
|
||||
public bool Equals(TankInfoHistoryKey other)
|
||||
{
|
||||
if (ReferenceEquals(null, other)) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
return AccountId == other.AccountId && TankId == other.TankId && LastBattleTime == other.LastBattleTime;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
if (obj.GetType() != this.GetType()) return false;
|
||||
return Equals((TankInfoHistoryKey) obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(AccountId, TankId, LastBattleTime);
|
||||
}
|
||||
|
||||
public static bool operator ==(TankInfoHistoryKey left, TankInfoHistoryKey right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(TankInfoHistoryKey left, TankInfoHistoryKey right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
|
||||
namespace WotBlitzStatisticsPro.DataAccess.Model.Accounts
|
||||
{
|
||||
public class TankInfoKey : IEquatable<TankInfoKey>
|
||||
{
|
||||
public TankInfoKey()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TankInfoKey(long accountId, long tankId)
|
||||
{
|
||||
AccountId = accountId;
|
||||
TankId = tankId;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// Player account identifier
|
||||
///</summary>
|
||||
public long AccountId { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Tank identifier
|
||||
///</summary>
|
||||
public long TankId { get; set; }
|
||||
|
||||
public bool Equals(TankInfoKey other)
|
||||
{
|
||||
if (ReferenceEquals(null, other)) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
return AccountId == other.AccountId && TankId == other.TankId;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
if (ReferenceEquals(this, obj)) return true;
|
||||
if (obj.GetType() != this.GetType()) return false;
|
||||
return Equals((TankInfoKey) obj);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(AccountId, TankId);
|
||||
}
|
||||
|
||||
public static bool operator ==(TankInfoKey left, TankInfoKey right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
public static bool operator !=(TankInfoKey left, TankInfoKey right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user