Пример #1
0
 public void Guardar()
 {
     try
     {
         using (var db = new ModeloCONCURSO())
         {
             if (this.IDCONCURSO > 0)
             {
                 db.Entry(this).State = EntityState.Modified;
             }
             else
             {
                 db.Entry(this).State = EntityState.Added;
             }
             db.SaveChanges();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
 public void Guardar()
 {
     try
     {
         using (var db = new ModeloCONCURSO())
         {
             if (this.IDCATEGORIA > 0)
             {
                 db.Entry(this).State = EntityState.Modified;
             }
             else
             {
                 db.Entry(this).State = EntityState.Added;
             }
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Пример #3
0
 public void Eliminar()
 {
     try
     {
         using (var db = new ModeloCONCURSO())
         {
             db.Entry(this).State = EntityState.Deleted;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }