From eb7c817329bcdd9eb520c6760bacf84d6f45f20d Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 11 Dec 2020 10:04:43 +0200 Subject: Reverted UserDbRepository to use the .Any Linq method --- API/Database/UserDbRepository.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'API/Database/UserDbRepository.cs') diff --git a/API/Database/UserDbRepository.cs b/API/Database/UserDbRepository.cs index 7a11621..a51e3a8 100644 --- a/API/Database/UserDbRepository.cs +++ b/API/Database/UserDbRepository.cs @@ -17,16 +17,16 @@ namespace API.Database this._dbRepository = new DbRepository(context); } - public async Task DoesUsernameExist(string username) + public bool DoesUsernameExist(string username) { - return await this._dbRepository.DbSet - .SingleAsync(x => x.UserName == username) == null; + return this._dbRepository.DbSet + .Any(x => x.UserName == username); } - public async Task DoesUserExist(int id) + public bool DoesUserExist(int id) { - return await this._dbRepository.DbSet - .SingleAsync(x => x.Id == id) == null; + return this._dbRepository.DbSet + .Any(x => x.Id == id); } } -} \ No newline at end of file +} -- cgit v1.2.3