예제 #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;
        }
예제 #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();
        }