aboutsummaryrefslogtreecommitdiff
path: root/API
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2020-12-11 09:04:55 +0200
committertranstrike <transtrike@gmail.com>2020-12-11 09:04:55 +0200
commit13bf04d5ce0a217b02ff74cd576ed27d1d106cc1 (patch)
tree07a6839975d17af9ef06acdece9086f83dc3a34d /API
parentedefd4a53ad8bb5318e8c6fc347f04ef3ac2886c (diff)
downloadDevHive-13bf04d5ce0a217b02ff74cd576ed27d1d106cc1.tar
DevHive-13bf04d5ce0a217b02ff74cd576ed27d1d106cc1.tar.gz
DevHive-13bf04d5ce0a217b02ff74cd576ed27d1d106cc1.zip
Modified UserDbRepo for performance
Diffstat (limited to 'API')
-rw-r--r--API/Database/UserDbRepository.cs12
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