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); } }
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); }
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); }