diff options
| author | transtrike <transtrike@gmail.com> | 2020-12-11 00:39:23 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2020-12-11 00:39:23 +0200 |
| commit | edefd4a53ad8bb5318e8c6fc347f04ef3ac2886c (patch) | |
| tree | a49dcb7a139aa52bc4948243916399e28ff1c601 /API/Database/UserDbRepository.cs | |
| parent | fcdecc38741dc8e3adb41897ee294aa6d1384128 (diff) | |
| download | DevHive-edefd4a53ad8bb5318e8c6fc347f04ef3ac2886c.tar DevHive-edefd4a53ad8bb5318e8c6fc347f04ef3ac2886c.tar.gz DevHive-edefd4a53ad8bb5318e8c6fc347f04ef3ac2886c.zip | |
Fixed Validations in UserService. Removed unnessessary code. Swagger not working
Diffstat (limited to 'API/Database/UserDbRepository.cs')
| -rw-r--r-- | API/Database/UserDbRepository.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/API/Database/UserDbRepository.cs b/API/Database/UserDbRepository.cs new file mode 100644 index 0000000..a4a3ac0 --- /dev/null +++ b/API/Database/UserDbRepository.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Models.Interfaces.Database; +using Microsoft.EntityFrameworkCore; +using Models.Classes; + +namespace API.Database +{ + public class UserDbRepository : DbRepository<User> + { + private readonly DbRepository<User> _dbRepository; + + public UserDbRepository(DbContext context) + : base (context) + { + this._dbRepository = new DbRepository<User>(context); + } + + public bool DoesUsernameExist(string username) + { + return this._dbRepository.DbSet + .Any(x => x.UserName == username); + } + + public bool DoesUserExist(int id) + { + return this._dbRepository.DbSet + .Any(x => x.Id == id); + } + } +}
\ No newline at end of file |
