예제 #1
0
        public ActionResult <Estudiante> PostStudent([FromBody] Estudiante student)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var createStudent = estudianteService.CreateEstudiante(student);

            return(Created($"/api/student/{createStudent.id}", createStudent));
        }
예제 #2
0
 public IActionResult Post(EstudianteDTOs estudiante)  //primer post de creacion o agregar un estudiante
 {
     try
     {
         return(new JsonResult(_service.CreateEstudiante(estudiante))
         {
             StatusCode = 200
         });
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }