blob: 7a116213389d43535c1f71c10ff3fe04627df3ab (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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 async Task<bool> DoesUsernameExist(string username)
{
return await this._dbRepository.DbSet
.SingleAsync(x => x.UserName == username) == null;
}
public async Task<bool> DoesUserExist(int id)
{
return await this._dbRepository.DbSet
.SingleAsync(x => x.Id == id) == null;
}
}
}
|