Esempio n. 1
0
        //Metodo Eliminar

        public void Eliminar()
        {
            try
            {
                //1.Origen de datos
                using (var db = new ReservaCita())
                {
                    db.Entry(this).State = EntityState.Deleted;
                    db.SaveChanges();
                }
            }
            catch (Exception eX)
            {
                throw;
            }
        }
Esempio n. 2
0
 //Metodo guardar
 public void Guardar()
 {
     try
     {
         //1.Origen de datos
         using (var db = new ReservaCita())
         {
             if (this.especialista_id > 0) //Existe el id
             {
                 db.Entry(this).State = EntityState.Modified;
             }
             else
             {
                 db.Entry(this).State = EntityState.Added;
             }
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }