Exemplo n.º 1
0
        public void DeleteProfesorTest()
        {
            Profesor objProfesor = context.Profesor.FirstOrDefault(x => x.Nombres == "Profesor1");
            int      NumProf     = context.Profesor.ToList().Count;

            profesorService.Delete(objProfesor.IdProfesor);
            int NewNumProf = context.Profesor.ToList().Count;

            Assert.AreEqual(NewNumProf, NumProf - 1);
        }
Exemplo n.º 2
0
 public ActionResult DeleteProfesor(int?IdProfesor)
 {
     try
     {
         profesorService.Delete(IdProfesor);
         return(RedirectToAction("LstProfesor"));
     }
     catch (Exception ex)
     {
         return(RedirectToAction("LstProfesor"));
     }
 }
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            if (!CommonHelper.SeleccionoRegistro(dgvGrilla))
            {
                return;
            }

            if (!CommonHelper.Confirma())
            {
                return;
            }

            try
            {
                ProfesorService s       = new ProfesorService();
                Profesor        entidad = (Profesor)dgvGrilla.SelectedRows[0].DataBoundItem;
                s.Delete(entidad.Id);
                cargarGrilla();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }