public ActionResult <object> AddCurso([FromBody] DTOCurso curso) { if (!ModelState.IsValid) { return(NotFound()); } var newCurso = Context.Curso.Find(curso.CursoId); if (newCurso == null) { newCurso = new Curso(); Context.Curso.Add(newCurso); } newCurso.Nombre = curso.Nombre; newCurso.EstadoId = 1; Context.SaveChanges(); return(Ok()); }
public ActionResult <object> AddProfesor([FromBody] DTOProfesor profesor) { if (!ModelState.IsValid) { return(NotFound()); } var newProfesor = new Profesor() { Nombre = profesor.Nombre, ApellidoPaterno = profesor.ApellidoPaterno, ApellidoMaterno = profesor.ApellidoMaterno, Dni = profesor.Dni, EstadoId = profesor.EstadoId }; Context.Profesor.Add(newProfesor); Context.SaveChanges(); return(Ok()); }
public ActionResult <object> AddAlumno([FromBody] DTOAlumno alumno) { if (!ModelState.IsValid) { return(NotFound()); } var newAlumno = new Alumno() { Nombre = alumno.Nombre, ApellidoPaterno = alumno.ApellidoPaterno, ApellidoMaterno = alumno.ApellidoMaterno, Dni = alumno.Dni, FechaNacimiento = alumno.FechaNacimiento, EstadoId = alumno.EstadoId }; Context.Alumno.Add(newAlumno); Context.SaveChanges(); return(Ok()); }
public ActionResult <object> SendRequest([FromBody] ResponseNotificacion respuesta) { NotificacionRespuesta notificacionRespuesta = new NotificacionRespuesta() { NotificacionId = respuesta.NotificacionId, Mensaje = respuesta.Mensaje, EstadoId = 1, Fecha = DateTime.Now }; Context.NotificacionRespuesta.Add(notificacionRespuesta); Context.SaveChanges(); return(new { mensaje = "OK" }); }
public ActionResult <object> AddCurso([FromBody] DTOMatricula matricula) { if (!ModelState.IsValid) { return(NotFound()); } var newMatricula = new Matricula() { MatriculaId = 0, CodigoMatricula = matricula.CodigoMatricula, AlumnoId = matricula.AlumnoId, GradoAcademicoId = matricula.GradoAcademicoId, FechaCreacion = matricula.FechaCreacion, EstadoId = matricula.EstadoId }; var cursoGrado = Context.GradoAcademicoCurso.Where(x => x.GradoAcademicoId == matricula.GradoAcademicoId).ToList(); Context.Matricula.Add(newMatricula); Context.SaveChanges(); return(Ok()); }