Exemplo n.º 1
0
        //public static List<T> getListByRelationship(int id)
        //{

        //}

        ///<summary>פונקציה לשליפת כל הלומדים  לתורם מסויםsummary>
        ///<param>the id of the relevant donor</param>
        ///<returns>list of the learners that are connected to this donor</returns>
        public static List <Learner> GetLearnersByDonor(string donorId)
        {
            using (BTProjectEntities db = new BTProjectEntities())
            {
                // calles the function above, but for all the donor's reqeusts.

                List <Request> allRequests = Request.cToDTO(db.request_tbl.ToList());
                allRequests = allRequests.Where(r => r.donorEmail == donorId).ToList();

                List <Learner> res = new List <Learner>();
                foreach (Request ra in allRequests)
                {
                    res.AddRange(SingleLearner.GetLearnesForBookByReq(ra.reqId));
                }
                return(res);
            }
        }
Exemplo n.º 2
0
        ///<summary>פונקציה לשליפת כל הלומדים של ספר מסוים לתורם מסוים=כל הלומדים מבקשה מסוימת.</summary>
        ///<param>the id of the relevant request</param>
        ///<returns>list of the learners that are connected to this request</returns>
        public static List <Learner> GetLearnesForBookByReq(int requestId)
        {
            using (BTProjectEntities db = new BTProjectEntities())
            {
                List <Learner> allLearners = Learner.cToDTO(db.learners_tbl.ToList());

                List <int>     correntIDs = SingleLearner.GetMatchingsPerRequest(requestId);
                List <Learner> res        = new List <Learner>();
                foreach (Learner l in allLearners)
                {
                    if (correntIDs.Contains(l.learnerId))
                    {
                        res.Add(l);
                    }
                }
                return(res);
            }
        }