private static Contact mapResort(Entity item) { return(new Contact() { id = item.id, naam = item.naam, bio = item.bio }); }
/// <summary> /// het update van de afdeling gegevens en of het toevoegen er van /// </summary> /// <param name="afdeling"></param> /// <returns></returns> public int UpdateResort(Contact contract) { Entity entity = map(contract); using (var context = new Connectie()) { if (contract.id == 0) { context.Resort.Add(entity); } else { var query = from b in context.Resort where b.id == contract.id select b; context.Entry(query.First()).CurrentValues.SetValues(entity); } context.SaveChanges(); return(context.Resort.First().id); } }