This repository has been archived on 2024-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
NG_2023_Kanban/NG_2023_Kanban.DataLayer/Repositories/UserRepository.cs
2023-07-23 17:46:06 +03:00

29 lines
993 B
C#

using NG_2023_Kanban.DataLayer.DbStartup;
using NG_2023_Kanban.DataLayer.Entities;
using NG_2023_Kanban.DataLayer.Interfaces;
using Microsoft.EntityFrameworkCore;
namespace NG_2023_Kanban.DataLayer.Repositories;
public class UserRepository : BaseRepository<User>, IUserRepository
{
public UserRepository(DatabaseContext context) : base(context) { }
public async Task<ICollection<User>> GetAllAsync()
=> await _context.Set<User>().Select(x => x).
Include(x => x.Boards).
Include(x => x.CardsAssigned).
Include(x => x.CardsSent).
Include(x => x.Comments).
Include(x => x.Roles).
ToListAsync();
public async Task<User> GetAsync(int id)
=> await _context.Set<User>().
Include(x => x.Boards).
Include(x => x.CardsAssigned).
Include(x => x.CardsSent).
Include(x => x.Comments).
Include(x => x.Roles).
FirstAsync(x => x.Id == id);
}