Exemplo n.º 1
0
        public void Delete(Guid LocalServicioID)
        {
            TLocalServicio dbEntry = context.TLocalServicio
                                     .FirstOrDefault(p => p.LocalId == LocalServicioID);

            if (dbEntry != null)
            {
                context.TLocalServicio.Remove(dbEntry);
                context.SaveChanges();
            }
            //return dbEntry;
        }
Exemplo n.º 2
0
        public async Task Save(TLocalServicio localServicio)
        {
            if (localServicio.LocServId == Guid.Empty)
            {
                localServicio.LocServId = Guid.NewGuid();
                context.TLocalServicio.Add(localServicio);
            }
            else
            {
                TLocalServicio dbEntry = context.TLocalServicio
                                         .FirstOrDefault(p => p.LocalId == localServicio.LocalId);
                if (dbEntry != null)
                {
                    dbEntry.LocalId = localServicio.LocalId;
                    dbEntry.ServId  = localServicio.ServId;
                }
            }

            await context.SaveChangesAsync();
        }