//public IEnumerable<JobRequest> RecJOBREQ(int id, JobRequest rj) //{ // ServiceJobRequest js = new ServiceJobRequest(); // IEnumerable<JobRequest> events = js.GetMany(); // List<JobRequest> resultatEvent = new List<JobRequest>(); // foreach (JobRequest t in events) // { // if (t.UserId == id && t.JobOfferId == rj.JobOfferId) // { // resultatEvent.Add(t); // } // } // return resultatEvent; //} public JobRequest RecJOBREQ(int id, JobRequest rj) { ServiceJobRequest js = new ServiceJobRequest(); IEnumerable <JobRequest> events = js.GetMany(); IEnumerable <JobRequest> events2 = (from e in events where e.UserId == id && e.JobOfferId == rj.JobOfferId select e); if (!events2.Any()) { return(null); } return(events2.First()); }
public IEnumerable <JobRequest> getJobRequestId(int idressource) { ServiceJobRequest sv = new ServiceJobRequest(); IEnumerable <JobRequest> events = sv.GetMany(); IEnumerable <JobRequest> resultatEvent = new JobRequest[] { }; foreach (JobRequest t in events) { Console.WriteLine(t.UserId); Console.WriteLine(idressource); if (t.UserId == idressource) { resultatEvent.ToList().Add(t); } } return(resultatEvent); }