public override void Update(location entity) { var ctx = new InventarisierungsloesungDB(); { try { var toUpdate = ctx.locations.Find(entity.location_id); ctx.locations.Attach(toUpdate); ctx.SaveChanges(); } catch (Exception e) { MessageBox.Show("Es konnte keine Verbindung zur Datenbank hergestellt werden: " + e.Message); } } ctx.Dispose(); }
public List <location> GetLocationsWithCte() { var ctx = new InventarisierungsloesungDB(); var locationsList = new List <location>(); { try { var result = ctx.cte_locations(); foreach (location loc in result) { locationsList.Add(loc); } } catch (Exception e) { MessageBox.Show("Es konnte keine Verbindung zur Datenbank hergestellt werden: " + e.Message); } ctx.Dispose(); return(locationsList); } }