diff options
| author | transtrike <transtrike@gmail.com> | 2020-12-11 09:04:55 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2020-12-11 09:04:55 +0200 |
| commit | 13bf04d5ce0a217b02ff74cd576ed27d1d106cc1 (patch) | |
| tree | 07a6839975d17af9ef06acdece9086f83dc3a34d /API/Database | |
| parent | edefd4a53ad8bb5318e8c6fc347f04ef3ac2886c (diff) | |
| download | DevHive-13bf04d5ce0a217b02ff74cd576ed27d1d106cc1.tar DevHive-13bf04d5ce0a217b02ff74cd576ed27d1d106cc1.tar.gz DevHive-13bf04d5ce0a217b02ff74cd576ed27d1d106cc1.zip | |
Modified UserDbRepo for performance
Diffstat (limited to 'API/Database')
| -rw-r--r-- | API/Database/UserDbRepository.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/API/Database/UserDbRepository.cs b/API/Database/UserDbRepository.cs index a4a3ac0..7a11621 100644 --- a/API/Database/UserDbRepository.cs +++ b/API/Database/UserDbRepository.cs @@ -17,16 +17,16 @@ namespace API.Database this._dbRepository = new DbRepository<User>(context); } - public bool DoesUsernameExist(string username) + public async Task<bool> DoesUsernameExist(string username) { - return this._dbRepository.DbSet - .Any(x => x.UserName == username); + return await this._dbRepository.DbSet + .SingleAsync(x => x.UserName == username) == null; } - public bool DoesUserExist(int id) + public async Task<bool> DoesUserExist(int id) { - return this._dbRepository.DbSet - .Any(x => x.Id == id); + return await this._dbRepository.DbSet + .SingleAsync(x => x.Id == id) == null; } } }
\ No newline at end of file |
