コード例 #1
0
        public domain.OcenaCollection GetByPredmetId(int PredmetId)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                IQueryable <model.Ocenka> query         = context.Ocenkas.Where(c => c.Predmet_ID == PredmetId);
                domain.OcenaCollection    domainObjects = ToDomainObjects(query.ToList());

                return(domainObjects);
            }
        }
コード例 #2
0
 private domain.OcenaCollection ToDomainObjects(List <model.Ocenka> list)
 {
     domain.OcenaCollection domainObjects = new domain.OcenaCollection();
     foreach (model.Ocenka modelObject in list)
     {
         domain.Ocena domainObject = ToDomain(modelObject);
         domainObject.student.Id = modelObject.Korisnik_ID;
         domainObject.predmet.Id = modelObject.Predmet_ID;
         domainObject.Ocenka     = modelObject.Ocenka1;
         domainObjects.Add(domainObject);
     }
     return(domainObjects);
 }
コード例 #3
0
        public domain.OcenaCollection GetAll()
        {
            model.LearnByPracticeDataContext context = CreateContext();
            IQueryable <model.Ocenka>        query   = context.Ocenkas;

            domain.OcenaCollection result = new domain.OcenaCollection();
            foreach (model.Ocenka modelObject in query)
            {
                domain.Ocena domainObject = new domain.Ocena();
                domainObject.student.Id = modelObject.Korisnik_ID;
                domainObject.predmet.Id = modelObject.Predmet_ID;
                domainObject.Ocenka     = modelObject.Ocenka1;
                result.Add(domainObject);
            }

            return(result);
        }