private domain.PrijavaStudent ToDomain(model.Prijava_Korisnik modelObject)
 {
     domain.PrijavaStudent domainObject = new domain.PrijavaStudent();
     domainObject.student.Id = modelObject.Korisnik_ID;
     domainObject.prijava.Id = modelObject.Prijava_ID;
     return(domainObject);
 }
 public domain.PrijavaStudent Update(domain.PrijavaStudent domainObject)
 {
     using (model.LearnByPracticeDataContext context = CreateContext())
     {
         IQueryable <model.Prijava_Korisnik> query = context.Prijava_Korisniks.Where(p => p.Korisnik_ID == domainObject.student.Id);
         model.Prijava_Korisnik modelObject        = query.Single();
         modelObject.Korisnik_ID = domainObject.student.Id;
         modelObject.Prijava_ID  = domainObject.prijava.Id;
         context.SubmitChanges();
         domain.PrijavaStudent result = ToDomain(modelObject);
         return(result);
     }
 }
        public domain.PrijavaStudent Insert(domain.PrijavaStudent domainObject)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                model.Prijava_Korisnik modelObject = new model.Prijava_Korisnik();
                modelObject.Prijava_ID  = domainObject.prijava.Id;
                modelObject.Korisnik_ID = domainObject.student.Id;
                context.Prijava_Korisniks.InsertOnSubmit(modelObject);
                context.SubmitChanges();
                domain.PrijavaStudent result = ToDomain(modelObject);

                return(result);
            }
        }