public static List <DAL.Reservation> LesenFremdschluesselGleich(DAL.Platz suchschluessel) { using (var context = new DAL.Context()) { return((from record in context.Reservation.Include("Platz") where record.Platz.PlatzId == suchschluessel.PlatzId select record).ToList()); } }
public static void Loeschen(DAL.Platz platz) { using (var context = new DAL.Context()) { context.Platz.Remove(platz); context.SaveChanges(); } }
public static void Aktualisieren(DAL.Platz platz) { using (var context = new DAL.Context()) { //TODO null Checks? context.Entry(platz).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public static Int64 Erstellen(DAL.Platz platz) { if (platz.Name == null || platz.Name == "") { platz.Name = "leer"; } using (var context = new DAL.Context()) { context.Platz.Add(platz); context.SaveChanges(); return(platz.PlatzId); } }