Exemplo n.º 1
0
        public void CreateProfesorTest()
        {
            AddEditProfesorViewModel objViewModel = new AddEditProfesorViewModel();
            int NumProf = context.Profesor.ToList().Count;

            objViewModel.GenerateProfesor(null, "Profesor1", "Apellidos1", "Lugar1", new DateTime(1996, 12, 18));
            profesorService.Create(objViewModel);
            int NewNumProf = context.Profesor.ToList().Count;

            Assert.AreEqual(NewNumProf, NumProf + 1);
        }
Exemplo n.º 2
0
        public ActionResult AddEditProfesor(AddEditProfesorViewModel objViewModel)
        {
            try
            {
                if (objViewModel.IdProfesor.HasValue)
                {
                    profesorService.Update(objViewModel);
                }
                else
                {
                    profesorService.Create(objViewModel);
                }

                return(RedirectToAction("LstProfesor"));
            }
            catch (Exception ex)
            {
                return(View(objViewModel));
            }
        }