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