19 lines
450 B
C#
19 lines
450 B
C#
using models.Core;
|
|
using models.Request;
|
|
using MongoDB.Driver;
|
|
|
|
namespace data.Events;
|
|
|
|
public class GetInDates
|
|
{
|
|
public List<Event> Execute(DateTime? startDate, DateTime? endDate)
|
|
{
|
|
var database = MongoFactory.GetDatabase();
|
|
var collection = database.GetCollection<Event>("events");
|
|
|
|
return collection.Find(x =>
|
|
startDate <= x.Date
|
|
&& x.Date <= endDate
|
|
).ToList();
|
|
}
|
|
} |