Exemplo n.º 1
0
 private static Contact mapUuid(Entity item)
 {
     return(new Contact()
     {
         id = item.id,
         uniqueidentifier = item.uniqueidentifier,
         gebruikerid = item.gebruikerid
     });
 }
Exemplo n.º 2
0
        /// <summary>
        /// het update van de uuid gegevens en of het toevoegen er van
        /// </summary>
        /// <param name="Uuid"></param>
        /// <returns></returns>
        public int UpdateUuid(Contact contract)
        {
            Entity entity = map(contract);

            using (var context = new Connectie())
            {
                if (contract.id == 0)
                {
                    context.Uuid.Add(entity);
                }
                else
                {
                    var query = from b in context.Uuid
                                where b.id == contract.id
                                select b;

                    context.Entry(query.First()).CurrentValues.SetValues(entity);
                }
                context.SaveChanges();

                return(context.Uuid.First().id);
            }
        }