Beispiel #1
0
 public static bool Create(Dependencia entity)
 {
     using (var db = new SirindarDbContext())
     {
         try
         {
             db.Entry(entity).State = EntityState.Added;
             db.SaveChanges();
         }
         catch (Exception)
         {
             return false;
         }
     }
     return true;
 }
Beispiel #2
0
 public static bool Create(Entrenador entity)
 {
     using (var db = new SirindarDbContext())
     {
         try
         {
             db.Entry(entity);
             db.SaveChanges();
         }
         catch (Exception)
         {
             return false;
         }
     }
     return true;
 }
 public static bool UpdateCantidadComidas(CantidadComidas entity)
 {
     using (var db = new SirindarDbContext())
     {
         try
         {
             entity.FechaModificacion = DateTime.Now;
             db.CantidadComidas.Attach(entity);
             db.Entry(entity).Property(p => p.FechaModificacion).IsModified = true;
             db.Entry(entity).Property(p => p.Cantidad).IsModified = true;
             db.Entry(entity).Property(p => p.Lunes).IsModified = true;
             db.Entry(entity).Property(p => p.Martes).IsModified = true;
             db.Entry(entity).Property(p => p.Miercoles).IsModified = true;
             db.Entry(entity).Property(p => p.Jueves).IsModified = true;
             db.Entry(entity).Property(p => p.Viernes).IsModified = true;
             db.Entry(entity).Property(p => p.Sabado).IsModified = true;
             db.Entry(entity).Property(p => p.Domingo).IsModified = true;
             db.SaveChanges();
             return true;
         }
         catch (Exception)
         {
             return false;
         }
     }
 }