Example #1
0
 public Program GetProgram(int id)
 {
     using (var context = new PowerContext(options.Options))
     {
         return(context.Programs.Include(i => i.Image).SingleOrDefault(p => p.Id == id));
     }
 }
Example #2
0
 public IEnumerable <ITrainingItem> GetAll()
 {
     using (var context = new PowerContext(options.Options))
     {
         return(context.Programs.Include(i => i.Image).ToArray());
     }
 }
Example #3
0
 public TrainingItemImage GetImage(int id)
 {
     using (var context = new PowerContext(options.Options))
     {
         return(context.Images.SingleOrDefault(p => p.Id == id));
     }
 }
Example #4
0
        public int Add(Program p)
        {
            using (var context = new PowerContext(options.Options))
            {
                context.Programs.Add(p);

                return(context.SaveChanges());
            }
        }
Example #5
0
        public int Add(TrainingItemImage t)
        {
            using (var context = new PowerContext(options.Options))
            {
                context.Images.Add(t);

                return(context.SaveChanges());
            }
        }
Example #6
0
        public int Add(Course c)
        {
            using (var context = new PowerContext(options.Options))
            {
                context.Courses.Add(c);

                return(context.SaveChanges());
            }
        }