mirror of
https://github.com/rjNemo/ticket_manager
synced 2026-06-06 00:36:39 +00:00
37 lines
No EOL
1 KiB
C#
37 lines
No EOL
1 KiB
C#
using System.Threading.Tasks;
|
|
using TicketManager.Models;
|
|
using System.Linq;
|
|
using System;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System.Collections.Generic;
|
|
|
|
namespace TicketManager.Data
|
|
{
|
|
public class AppUserRepository : GenericRepository<AppUser>, IAppUserRepository
|
|
{
|
|
private readonly IQueryable<AppUser> _query;
|
|
public AppUserRepository(AppDbContext context) : base(context)
|
|
{
|
|
_query = _dbSet
|
|
.Include(p => p.Assignments)
|
|
.ThenInclude(a => a.Project)
|
|
.ThenInclude(p => p.Tickets)
|
|
.Include(p => p.Activities);
|
|
}
|
|
|
|
public async Task<AppUser> GetUser(Guid id)
|
|
{
|
|
return await _query.FirstOrDefaultAsync(p => p.Id == id);
|
|
}
|
|
|
|
public override async Task<IEnumerable<AppUser>> List()
|
|
{
|
|
return await _query.ToListAsync();
|
|
}
|
|
|
|
public bool Exists(Guid id)
|
|
{
|
|
return _dbSet.Any(e => e.Id == id);
|
|
}
|
|
}
|
|
} |