Exemple #1
0
 public int AddPerson(string Name, Global.PersonType pType)
 {
     PersonContext db = new PersonContext();
     Person p;
     switch (pType)
     {
         case Global.PersonType.Teacher:
             p = new Teacher { PersonName = Name };
             break;
         case Global.PersonType.Secretary:
             p = new Secretary { PersonName = Name };
             break;
         default:
             p = new Person { PersonName = Name };
             break;
     }
     db.Persons.Add(p);
     db.SaveChanges();
     return p.PersonId;
 }
Exemple #2
0
 public List<Person> GetAllPersons()
 {
     PersonContext db = new PersonContext();
     return db.Persons.ToList();
 }