Exemplo n.º 1
0
 public void Save(Seminar obj)
 {
     if (obj.ID == 0)
     {
         obj.ID = objects.Count + 1;
         objects.Add(obj);
     }
     else
     {
         var pos = PosOf(obj.ID);
         objects[pos] = obj;
     }
 }
Exemplo n.º 2
0
        private void CreateDummyData()
        {
            var p1 = new Person()
            {
                Firstname = "Alex",
                Lastname  = "Stuckenholz",
                IsAdmin   = true,
                EMail     = "*****@*****.**",
                Password  = "******"
            };

            var p2 = new Person()
            {
                Firstname = "Anne",
                Lastname  = "Meier",
                IsAdmin   = false
            };

            person_repository.Save(p1);
            person_repository.Save(p2);

            var s1 = new Seminar()
            {
                Name      = "Objectoriented programming",
                Extent    = "2L2E",
                TeacherID = p1.ID
            };

            var s2 = new Seminar()
            {
                Name      = "Energy informatics",
                Extent    = "2L",
                TeacherID = p1.ID
            };

            seminar_repository.Save(s1);
            seminar_repository.Save(s2);

            attendee_repository.Save(s1.ID, new List <int>()
            {
                p2.ID
            });
            attendee_repository.Save(s2.ID, new List <int>()
            {
                p2.ID
            });
        }