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(); } }
private static Person MapDataToPerson(Basistrainig.RM.DataAccess.Person p) { return(new Person() { PersonID = p.PersonID, firstname = p.FirstName, lastname = p.LastName }); }
public Person Save() { using (var context = new SchoolEntities()) { Basistrainig.RM.DataAccess.Person pers = MapPersonToData(this); context.Person.AddOrUpdate(pers); context.SaveChanges(); return(MapDataToPerson(pers)); } }