Add function to get the tunnel flights between dates

This commit is contained in:
Sébastien ANDRE
2023-06-22 20:24:28 +02:00
parent ef15986db3
commit 894f283654
5 changed files with 35 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
using skydiveLogs_api.Domain;
using skydiveLogs_api.DomainService.Repositories;
using skydiveLogs_api.Infrastructure.Interfaces;
using System;
using System.Collections.Generic;
namespace skydiveLogs_api.Infrastructure
@@ -64,6 +65,16 @@ namespace skydiveLogs_api.Infrastructure
.ToList();
}
public IEnumerable<TunnelFlight> GetBetweenDate(User user, DateTime beginDate, DateTime endDate)
{
return _col.Include(x => x.Tunnel)
.Query()
.OrderByDescending(j => j.FlightDate)
.Where(j => j.FlightDate >= beginDate)
.Where(j => j.FlightDate <= endDate)
.ToList();
}
public TunnelFlight GetById(int id)
{
return _col.FindById(new BsonValue(id));