feat: added User Screen for admins
This commit is contained in:
parent
0279df06fa
commit
df1ac86636
11 changed files with 163 additions and 31 deletions
|
@ -7,7 +7,12 @@ public static class UsersRepository
|
|||
public static async Task<List<UserData>> getUsersAsync()
|
||||
{
|
||||
await using var db = new AppDBContext();
|
||||
return await db.Users.ToListAsync();
|
||||
return await db.Users
|
||||
.Include(user => user.SubmittedReports)
|
||||
.Include(user => user.RecivedReports)
|
||||
.Include(user => user.Comments)
|
||||
.Include(user => user.Posts)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public static async Task<UserData> getUserByIdAsync(int userId)
|
||||
|
@ -19,7 +24,10 @@ public static class UsersRepository
|
|||
public static async Task<UserData> getUserByEmailAsync(string email)
|
||||
{
|
||||
await using var db = new AppDBContext();
|
||||
return await db.Users.FirstOrDefaultAsync(user => user.Email == email);
|
||||
return await db.Users
|
||||
.Where(user => user.Email == email)
|
||||
.Include(user => user.SubmittedReports)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public static async Task<int> createUserAsync(UserData userToCreate)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue