示例#1
0
        public void CrearEstudiante(CrearResponsableRequest request, string expected)
        {
            _service = new CrearResponsableService(_unitOfWork);
            var response = _service.Ejecutar(request);

            Assert.AreEqual(expected, response.Message);
        }
示例#2
0
        public CrearPreMatriculaResponse Ejecutar(CrearPreMatriculaRequest request)
        {
            var prematricula = _unitOfWork.PreMatriculaServiceRepository.FindFirstOrDefault(t => t.Id == request.id || t.IdUsuario == request.IdUsuario);

            if (prematricula == null)
            {
                Dominio.PreMatricula newPreMatricula = new Dominio.PreMatricula(request.FecPrematricula, request.IdUsuario, request.Estado);

                var respuestaE = estudianteService.Ejecutar(request.Estudiante);
                foreach (var responsable in request.Responsables)
                {
                    var respuesta = responsableService.Ejecutar(responsable);
                }
                IReadOnlyList <string> errors = newPreMatricula.CanCrear(newPreMatricula);
                if (errors.Any())
                {
                    string listaErrors = "Errores:";
                    foreach (var item in errors)
                    {
                        listaErrors += item.ToString();
                    }
                    return(new CrearPreMatriculaResponse()
                    {
                        Message = listaErrors
                    });
                }
                else
                {
                    _unitOfWork.PreMatriculaServiceRepository.Add(newPreMatricula);
                    _unitOfWork.Commit();
                    return(new CrearPreMatriculaResponse()
                    {
                        Message = $"PreMatricula Creada Exitosamente"
                    });
                }
            }
            else
            {
                return(new CrearPreMatriculaResponse()
                {
                    Message = $"PreMatricula ya existe"
                });
            }
        }