예제 #1
0
 public void Loeschen()
 {
     Basistrainig.RM.DataAccess.Person p = MapPersonToData(this);
     using (var context = new SchoolEntities())
     {
         context.Person.Attach(p);
         context.Person.Remove(p);
         context.SaveChanges();
     }
 }
예제 #2
0
        private static Person MapDataToPerson(Basistrainig.RM.DataAccess.Person p)
        {
            return(new Person()
            {
                PersonID = p.PersonID,

                firstname = p.FirstName,
                lastname = p.LastName
            });
        }
예제 #3
0
        public Person Save()
        {
            using (var context = new SchoolEntities())
            {
                Basistrainig.RM.DataAccess.Person pers = MapPersonToData(this);
                context.Person.AddOrUpdate(pers);

                context.SaveChanges();
                return(MapDataToPerson(pers));
            }
        }