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