Exemplo n.º 1
0
 private domain.Ocena ToDomain(model.Ocenka modelObject)
 {
     domain.Ocena domainObject = new domain.Ocena();
     domainObject.student.Id = modelObject.Korisnik_ID;
     domainObject.predmet.Id = modelObject.Predmet_ID;
     domainObject.Ocenka     = modelObject.Ocenka1;
     return(domainObject);
 }
Exemplo n.º 2
0
 public domain.Ocena Update(domain.Ocena domainObject)
 {
     using (model.LearnByPracticeDataContext context = CreateContext())
     {
         IQueryable <model.Ocenka> query = context.Ocenkas.Where(p => p.Korisnik_ID == domainObject.student.Id && p.Predmet_ID == domainObject.predmet.Id);
         model.Ocenka modelObject        = query.Single();
         modelObject.Ocenka1 = domainObject.Ocenka;
         context.SubmitChanges();
         domain.Ocena result = ToDomain(modelObject);
         return(result);
     }
 }
Exemplo n.º 3
0
        public domain.Ocena Insert(domain.Ocena domainObject)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                model.Ocenka modelObject = new model.Ocenka();
                modelObject.Korisnik_ID = domainObject.student.Id;
                modelObject.Predmet_ID  = domainObject.predmet.Id;
                modelObject.Ocenka1     = domainObject.Ocenka;
                context.Ocenkas.InsertOnSubmit(modelObject);
                context.SubmitChanges();
                domain.Ocena result = ToDomain(modelObject);

                return(result);
            }
        }