public async Task <Person> Get_by_Id(int id) { return(await Task.Run(() => { //Thread.Sleep(5000); //return from person in _personen // from adresse in _adressen // where person.Id == id && person.Adresse.Id == adresse.Id // select new { person.Vorname, person.Nachname, adresse.Strasse, adresse.Hausnummer }; using (var db = new PersonenDb()) { var person = db.Personen.Find(1); return person; } })); }
public IEnumerable <Person> Get_All() { using (var db = new PersonenDb()) { var all = from pers in db.Personen join add in db.Adressen on pers.Adresse.Id equals add.Id group new { pers, add } by add into g select new { a = g.Key.Strasse, b = g }; var a = 1; } return(new List <Person>()); }