Exemple #1
0
 private domain.StudiskaPrograma ToDomain(model.Studiska_Programa modelObject)
 {
     domain.StudiskaPrograma domainObject = new domain.StudiskaPrograma();
     domainObject.Id  = modelObject.ID;
     domainObject.Ime = modelObject.Ime;
     return(domainObject);
 }
Exemple #2
0
 public domain.StudiskaPrograma Delete(domain.StudiskaPrograma domainObject)
 {
     using (var context = CreateContext())
     {
         var modelObject = context.Studiska_Programas.Single(org => org.ID == domainObject.Id);
         context.Studiska_Programas.DeleteOnSubmit(modelObject);
         context.SubmitChanges();
         var deletedObject = ToDomain(modelObject);
         return(deletedObject);
     }
 }
Exemple #3
0
        public domain.StudiskaPrograma Get(int id)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                IQueryable <model.Studiska_Programa> query = context.Studiska_Programas.Where(c => c.ID == id);

                domain.StudiskaPrograma domainObject = ToDomain(query.Single());

                return(domainObject);
            }
        }
Exemple #4
0
 public domain.StudiskaPrograma Update(domain.StudiskaPrograma domainObject)
 {
     using (model.LearnByPracticeDataContext context = CreateContext())
     {
         IQueryable <model.Studiska_Programa> query = context.Studiska_Programas.Where(p => p.ID == domainObject.Id);
         model.Studiska_Programa modelObject        = query.Single();
         modelObject.Ime = domainObject.Ime;
         context.SubmitChanges();
         domain.StudiskaPrograma result = ToDomain(modelObject);
         return(result);
     }
 }
Exemple #5
0
        public domain.StudiskaPrograma Insert(domain.StudiskaPrograma domainObject)
        {
            using (model.LearnByPracticeDataContext context = CreateContext())
            {
                model.Studiska_Programa modelObject = new model.Studiska_Programa();
                modelObject.Ime = domainObject.Ime;
                context.Studiska_Programas.InsertOnSubmit(modelObject);
                context.SubmitChanges();
                domain.StudiskaPrograma result = ToDomain(modelObject);

                return(result);
            }
        }
Exemple #6
0
        public domain.StudiskaProgramaCollection GetAll()
        {
            model.LearnByPracticeDataContext     context = CreateContext();
            IQueryable <model.Studiska_Programa> query   = context.Studiska_Programas;

            domain.StudiskaProgramaCollection result = new domain.StudiskaProgramaCollection();
            foreach (model.Studiska_Programa modelObject in query)
            {
                domain.StudiskaPrograma domainObject = new domain.StudiskaPrograma();
                domainObject.Id  = modelObject.ID;
                domainObject.Ime = modelObject.Ime;
                result.Add(domainObject);
            }

            return(result);
        }