Beispiel #1
0
 private static Entity mapType(Contact item)
 {
     return(new Entity()
     {
         id = item.id,
         type = item.type,
         bio = item.bio,
         resortid = item.resortid
     });
 }
Beispiel #2
0
        /// <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);
            }
        }
Beispiel #3
0
 private Entity map(Contact contact)
 {
     return(mapType(contact));
 }