Пример #1
0
 public void Salve()
 {
     try
     {
         using (var ctx = new DBCursoContext())
         {
             if (this.IdAlumno > 0)
             {
                 ctx.Entry(this).State = EntityState.Modified;
             }
             else
             {
                 ctx.Entry(this).State = EntityState.Added;
             }
             ctx.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Пример #2
0
 public void Delected()
 {
     try
     {
         using (var ctx = new DBCursoContext())
         {
             if (this.IdAlumno > 0)
             {
                 ctx.Entry(this).State = EntityState.Deleted;
             }
             ctx.SaveChanges();
         }
     }
     catch (Exception e)
     {
         throw;
     }
 }