Beispiel #1
0
        public void Delete(Guid PrecioId)
        {
            TPrecio dbEntry = context.TPrecio
                              .FirstOrDefault(p => p.PrecId == PrecioId);

            if (dbEntry != null)
            {
                context.TPrecio.Remove(dbEntry);
                context.SaveChanges();
            }
            //return dbEntry;
        }
Beispiel #2
0
        public async Task Save(TPrecio precio)
        {
            if (precio.PrecId == Guid.Empty)
            {
                precio.PrecId = Guid.NewGuid();
                context.TPrecio.Add(precio);
            }
            else
            {
                TPrecio dbEntry = context.TPrecio
                                  .FirstOrDefault(p => p.PrecId == precio.PrecId);
                if (dbEntry != null)
                {
                    dbEntry.PrecMonto = precio.PrecMonto;
                    dbEntry.CanchaId  = precio.CanchaId;
                    dbEntry.TurnoId   = precio.TurnoId;
                }
            }

            await context.SaveChangesAsync();
        }