Files
parr_api/PARR.DAL/Services/Implementations/WeekendDayService.cs

33 lines
1005 B
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations
{
internal class WeekendDayService : BaseService<WeekendDay>, IWeekendDayService
{
private readonly DataContext dataContext;
private readonly ILogger<WeekendDayService> logger;
protected override DbSet<WeekendDay> EntitySet => dataContext.WeekendDays;
protected override DataContext EntitiContext => dataContext;
public WeekendDayService(DataContext dataContext, ILogger<WeekendDayService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
public IQueryable<DateOnly> GetWeekends(DateOnly start, DateOnly end)
{
return EntitySet.Where(t => t.Date >= start && t.Date <= end).Select(t => t.Date);
}
}
}