32 lines
903 B
C#
32 lines
903 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using PersianTools.Core;
|
|
using Shared.Contracts.Holidays;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace CompanyManagment.EFCore.Services;
|
|
|
|
public class HolidayQueryService : IHolidayQueryService
|
|
{
|
|
private readonly CompanyContext _context;
|
|
|
|
public HolidayQueryService(CompanyContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public async Task<List<HolidayDto>> GetHolidaysInDates(DateTime startDate, DateTime endDate)
|
|
{
|
|
return await _context.HolidayItems.Where(x => x.Holidaydate >= startDate && x.Holidaydate <= endDate).Select(x=> new HolidayDto()
|
|
{
|
|
Holidaydate = x.Holidaydate,
|
|
HolidayId = x.id,
|
|
HolidayYear = x.HolidayYear
|
|
})
|
|
.ToListAsync();
|
|
|
|
}
|
|
} |