Example #1
0
        public static void DeleteStudent()
        {
            Container cntr = new Container(baseUri);

            Student std = cntr.Students.Where(st => st.Id == 1).Single();

            cntr.DeleteObject(std);
            cntr.SaveChanges();
        }
Example #2
0
        public static void DeleteClass()
        {
            Container cntr = new Container(baseUri);

            Class cls = cntr.Classes.Where(clss => clss.Id == 1).Single();

            cntr.DeleteObject(cls);
            cntr.SaveChanges();
        }
Example #3
0
        public static void DeleteInstructor()
        {
            Container cntr = new Container(baseUri);

            Instructor instr = cntr.Instructors.Where(inst => inst.Id == 1).Single();

            cntr.DeleteObject(instr);
            cntr.SaveChanges();
        }
Example #4
0
        public static void EnrollToClass()
        {
            Container cntr = new Container(baseUri);

            Class cls = cntr.Classes.Where(clss => clss.Id == 2).Single();
            Student std = cntr.Students.Where(st => st.Id == 1).Single();

            cntr.AddLink(std, "Classes", cls);
            cntr.SaveChanges();
        }
Example #5
0
        public static void AddInstructor(string name)
        {
            Container cntr = new Container(baseUri);

            Instructor instr = new Instructor();
            instr.Name = name;

            cntr.AddObject("Instructors", instr);
            cntr.SaveChanges();
        }
Example #6
0
        public static void AddStudent()
        {
            Container cntr = new Container(baseUri);

            Student dan = new Student();
            dan.Name = "Dan";

            cntr.AddObject("Students", dan);
            cntr.SaveChanges();
        }
Example #7
0
        public static void AddClass()
        {
            Container cntr = new Container(baseUri);

            Class algorithms = new Class();
            algorithms.Name = "Algorithms";

            cntr.AddObject("Classes", algorithms);
            cntr.SaveChanges();
        }
Example #8
0
        public static void GetAllClasses()
        {
            Container cntr = new Container(baseUri);

            foreach (Class cls in cntr.Classes)
            {
                Console.WriteLine(cls.Id + ": " + cls.Name);
            }
        }
Example #9
0
        public static void UpdateStudent()
        {
            Container cntr = new Container(baseUri);

            Student std = cntr.Students.Where(st => st.Id == 1).Single();
            std.Name = std.Name + "-updated";

            cntr.UpdateObject(std);
            cntr.SaveChanges(SaveChangesOptions.ReplaceOnUpdate);
        }
Example #10
0
        public static void UpdateClass()
        {
            Container cntr = new Container(baseUri);

            Class cls = cntr.Classes.Where(clss => clss.Id == 1).Single();
            cls.Name = cls.Name + "-updated";

            cntr.UpdateObject(cls);
            cntr.SaveChanges(SaveChangesOptions.ReplaceOnUpdate);
        }
Example #11
0
        public static void UpdateInstructor()
        {
            Container cntr = new Container(baseUri);

            Instructor instr = cntr.Instructors.Where(inst => inst.Id == 1).Single();
            instr.Name = instr.Name + "-updated";

            cntr.UpdateObject(instr);
            cntr.SaveChanges(SaveChangesOptions.ReplaceOnUpdate);
        }
Example #12
0
        public static void GetAllStudentsInClass()
        {
            Container cntr = new Container(baseUri);

            var query = cntr.Classes.Where(clss => clss.Id == 2).SelectMany(clss => clss.Students);

            foreach (Student std in query)
            {
                Console.WriteLine(std.Name);
            }
        }
Example #13
0
        public static void GetAllStudents()
        {
            Container cntr = new Container(baseUri);

            foreach (Student std in cntr.Students)
            {
                Console.WriteLine(std.Name);
            }
        }
Example #14
0
        public static void GetAllInstructors()
        {
            Container cntr = new Container(baseUri);

            foreach (Instructor instr in cntr.Instructors)
            {
                Console.WriteLine(instr.Name);
            }
        }
Example #15
0
        public static void GetAllClassesOfStudent()
        {
            Container cntr = new Container(baseUri);

            var query = cntr.Students.Where(st => st.Id == 1).SelectMany(st => st.Classes);

            foreach (Class cls in query)
            {
                Console.WriteLine(cls.Name);
            }
        }
Example #16
0
        public static void GetAllClassesOfInstructor()
        {
            Container cntr = new Container(baseUri);

            Instructor instr = cntr.Instructors.Where(inst => inst.Id == 1).Single();

            foreach (Class cls in instr.Classes)
            {
                Console.WriteLine(cls.Name);
            }
        }