feat(bll, dal): WeekendDayService + БД. CalendarService - получение рабочих дней за период

This commit is contained in:
Mikhail Kuznetsov
2024-07-01 11:32:19 +10:00
parent 9632b0c560
commit ff37e6c10f
14 changed files with 2981 additions and 43 deletions

View 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);
}
}
}

View 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);
}
}