Ejemplo n.º 1
0
        public IActionResult CreateStudent(EnrollStudentRequest request)
        {
            var result = _dbService.CreateStudent(request);

            if (result != null)
            {
                return(Ok(result));
            }
            return(NotFound());
        }
Ejemplo n.º 2
0
        public IActionResult CreateStudent(EnrollStudentResponse request)
        {
            EnrollmentResponse enrollmentResponse = _studentsDbService.CreateStudent(request);

            if (enrollmentResponse == null)
            {
                return(BadRequest("studia nie istnieją"));
            }
            else
            {
                return(CreatedAtAction("createStudent", enrollmentResponse));
            }
        }
Ejemplo n.º 3
0
        public IActionResult CreateStudent(Student student)
        {
            if (student.IndexNumber == null || student.FirstName == null || student.LastName == null || student.BirthDate == null || student.StudiesName == null)
            {
                return(BadRequest("Can't be null"));
            }
            else if (student.IndexNumber.Length < 1 || student.FirstName.Length < 1 || student.LastName.Length < 1 || student.BirthDate.Length < 1 || student.StudiesName.Length < 1)
            {
                return(BadRequest());
            }

            return(_dbService.CreateStudent(student));
        }