Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Raxul257 committed Apr 17, 2019
1 parent 0477433 commit 0c403fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Uconomy.csproj
Expand Up @@ -29,8 +29,8 @@
<PackageReference Include="Rocket.Core" Version="5.0.0.663">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.4">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
11 changes: 6 additions & 5 deletions UconomyEconomyProvider.cs
Expand Up @@ -124,11 +124,12 @@ public async Task CreateAccountAsync(IUser user)
{
using (var db = new UconomyDbContext(Plugin))
{
if(await db.Accounts.AnyAsync(a => a.Id == user.Id)) return;

var account = new Account(user.Id, Plugin.ConfigurationInstance.InitialBalance);
await db.Accounts.AddAsync(account);
await db.SaveChangesAsync();
if (!await db.Accounts.AnyAsync(a => a.Id == user.Id))
{
var account = new Account(user.Id, Plugin.ConfigurationInstance.InitialBalance);
await db.Accounts.AddAsync(account);
await db.SaveChangesAsync();
}
}
}
}
Expand Down

0 comments on commit 0c403fb

Please sign in to comment.