mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-12 10:18:27 -04:00
vars and target-typed new
This commit is contained in:
@@ -94,9 +94,9 @@ public class CurrencyService : ICurrencyService, INService
|
||||
|
||||
public async Task AddBulkAsync(IEnumerable<ulong> userIds, IEnumerable<string> reasons, IEnumerable<long> amounts, bool gamble = false)
|
||||
{
|
||||
ulong[] idArray = userIds as ulong[] ?? userIds.ToArray();
|
||||
string[] reasonArray = reasons as string[] ?? reasons.ToArray();
|
||||
long[] amountArray = amounts as long[] ?? amounts.ToArray();
|
||||
var idArray = userIds as ulong[] ?? userIds.ToArray();
|
||||
var reasonArray = reasons as string[] ?? reasons.ToArray();
|
||||
var amountArray = amounts as long[] ?? amounts.ToArray();
|
||||
|
||||
if (idArray.Length != reasonArray.Length || reasonArray.Length != amountArray.Length)
|
||||
throw new ArgumentException("Cannot perform bulk operation. Arrays are not of equal length.");
|
||||
@@ -104,7 +104,7 @@ public class CurrencyService : ICurrencyService, INService
|
||||
var userIdHashSet = new HashSet<ulong>(idArray.Length);
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
for (int i = 0; i < idArray.Length; i++)
|
||||
for (var i = 0; i < idArray.Length; i++)
|
||||
{
|
||||
// i have to prevent same user changing more than once as it will cause db error
|
||||
if (userIdHashSet.Add(idArray[i]))
|
||||
@@ -126,7 +126,7 @@ public class CurrencyService : ICurrencyService, INService
|
||||
var userIdHashSet = new HashSet<ulong>(idArray.Length);
|
||||
using (var uow = _db.GetDbContext())
|
||||
{
|
||||
for (int i = 0; i < idArray.Length; i++)
|
||||
for (var i = 0; i < idArray.Length; i++)
|
||||
{
|
||||
// i have to prevent same user changing more than once as it will cause db error
|
||||
if (userIdHashSet.Add(idArray[i]))
|
||||
|
Reference in New Issue
Block a user