You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1 KiB

using Entity_Framework;
using Entity_Framework.Entity;
using Entity_Framework.Factories;
using Modele.Classe;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Extraction_Donnees.Extraction
{
public partial class Extraction
{
public Task<IEnumerable<Tour>> GetTours(long IdSession)
{
IEnumerable<Tours> result = new List<Tours>();
using (BDDContext db = new BDDContext())
{
bool checkSession = db.Sessions.Any(e => e.Id == IdSession);
if (checkSession == false)
{
return Task.FromResult<IEnumerable<Tour>>(null);
}
result = (from tour in db.Tours
from session in db.Sessions
where session.Id == tour.IdSession
select tour).ToList();
}
return Task.FromResult<IEnumerable<Tour>>(result.Select(e => e.EntityToModele()));
}
}
}