feat(bll, dal): WeekendDayService + БД. CalendarService - получение рабочих дней за период
This commit is contained in:
32
PARR.DAL/Services/Implementations/WeekendDayService.cs
Normal file
32
PARR.DAL/Services/Implementations/WeekendDayService.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
10
PARR.DAL/Services/Interfaces/IWeekendDayService.cs
Normal file
10
PARR.DAL/Services/Interfaces/IWeekendDayService.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Services.Interfaces.Base;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces
|
||||
{
|
||||
public interface IWeekendDayService : IBaseService<WeekendDay>
|
||||
{
|
||||
IQueryable<DateOnly> GetWeekends(DateOnly start, DateOnly end);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user