MeetingUserRepository.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Microsoft.EntityFrameworkCore;
  2. using MTWorkHR.Core.Entities;
  3. using MTWorkHR.Core.IDto;
  4. using MTWorkHR.Core.IRepositories;
  5. using MTWorkHR.Infrastructure.Entities;
  6. using MTWorkHR.Infrastructure.DBContext;
  7. namespace MTWorkHR.Infrastructure.Repositories
  8. {
  9. public class MeetingUserRepository : Repository<MeetingUser>, IMeetingUserRepository
  10. {
  11. private readonly DbSet<MeetingUser> dbSet;
  12. public MeetingUserRepository(HRDataContext context) : base(context)
  13. {
  14. dbSet = context.Set<MeetingUser>();
  15. }
  16. public virtual async Task<MeetingUser> AddAsync(MeetingUser entity)
  17. {
  18. await dbSet.AddAsync(entity);
  19. return entity;
  20. }
  21. public virtual async Task<IList<MeetingUser>> AddRangeAsync(IList<MeetingUser> entity)
  22. {
  23. await dbSet.AddRangeAsync(entity);
  24. return entity;
  25. }
  26. public virtual async Task DeleteAsync(MeetingUser entity)
  27. {
  28. dbSet.Remove(entity);
  29. }
  30. public virtual async Task DeleteAsync(IEnumerable<MeetingUser> entities)
  31. {
  32. dbSet.RemoveRange(entities);
  33. }
  34. }
  35. }