using Microsoft.EntityFrameworkCore;
using MTWorkHR.Core.Entities;
using MTWorkHR.Core.IDto;
using MTWorkHR.Core.IRepositories;
using MTWorkHR.Infrastructure.Entities;
using MTWorkHR.Infrastructure.DBContext;

namespace MTWorkHR.Infrastructure.Repositories
{
    public class ProjectTeamRepository : Repository<ProjectTeam>, IProjectTeamRepository
    {
        private readonly DbSet<ProjectTeam> dbSet;

        public ProjectTeamRepository(HRDataContext context) : base(context)
        {
            dbSet = context.Set<ProjectTeam>();

        }
        public virtual async Task<ProjectTeam> AddAsync(ProjectTeam entity)
        {
            await dbSet.AddAsync(entity);
            return entity;
        }

        public virtual async Task<IList<ProjectTeam>> AddRangeAsync(IList<ProjectTeam> entity)
        {
            await dbSet.AddRangeAsync(entity);
            return entity;
        }

        public virtual async Task DeleteAsync(ProjectTeam entity)
        {
            dbSet.Remove(entity);
        }

        public virtual async Task DeleteAsync(IEnumerable<ProjectTeam> entities)
        {
            dbSet.RemoveRange(entities);
        }
    }
}
