Ejemplo n.º 1
0
        public IActionResult EnrollStudent([FromBody] EnrollStudentRequest request, [FromServices] IStudentsDbService dbService)
        {
            Student studentToEnroll = new Student
            {
                IndexNumber = request.IndexNumber,
                LastName    = request.LastName,
                FirstName   = request.FirstName,
                BirthDate   = request.BirthDate
            };

            Enrollment tmp = dbService.EnrollStudent(studentToEnroll, request.Studies);

            if (tmp == null)
            {
                return(BadRequest());
            }

            EnrollStudentResponse response = new EnrollStudentResponse
            {
                Semester     = tmp.Semester,
                IdStudy      = tmp.IdStudy,
                StartDate    = tmp.StartDate,
                IdEnrollment = tmp.IdEnrollment
            };

            return(Ok(response));
        }
Ejemplo n.º 2
0
        public IActionResult EnrollStudent(EnrollStudentRequest req)
        {
            _dbService.EnrollStudent(req);
            var response = new EnrollStudentResponse();

            return(CreatedAtAction("EnrollStudent", response));
        }
Ejemplo n.º 3
0
        public IActionResult EnrollStudent(EnrollStudentRequest request)
        {
            if (_service.EnrollStudent(request) == false)
            {
                return(BadRequest(400));
            }

            return(Ok(200));
        }
Ejemplo n.º 4
0
 public IActionResult AddStudent(EnrollRequest request)
 {
     try
     {
         return(Ok(_dbService.EnrollStudent(request)));
     }catch (Exception exc)
     {
         return(BadRequest(exc.Message));
     }
 }
Ejemplo n.º 5
0
        public IActionResult EnrollStudent(EnrollStudentRequest request)
        {
            var enrollment = _studentsDbService.EnrollStudent(request);

            if (enrollment == null)
            {
                return(BadRequest());
            }
            return(Ok(enrollment.IdEnrollment));
        }
Ejemplo n.º 6
0
        public IActionResult EnrollStudent(EnrollStudentRequest request)
        {
            var enrollment = _service.EnrollStudent(request);

            if (enrollment == null)
            {
                return(BadRequest("400 Bad Request Error!"));
            }
            return(CreatedAtAction(nameof(EnrollStudent), enrollment));
        }
Ejemplo n.º 7
0
        public IActionResult EnrollStudent(Student s)
        {
            var result = _service.EnrollStudent(s);

            if (result != null)
            {
                return(CreatedAtAction(nameof(EnrollStudent), result));
            }
            return(BadRequest(result.IndexNumber));
        }
Ejemplo n.º 8
0
        public IActionResult EnrollStudent(EnrollStudentRequest request)
        {
            var result = _service.EnrollStudent(request);

            if (result != null)
            {
                return(Ok(result));
            }
            return(NotFound());
        }
Ejemplo n.º 9
0
        public IActionResult EnrollStudent(EnrollStudentRequest request)
        {
            var enr = _service.EnrollStudent(request);

            if (enr != null)
            {
                return(Created("Pomyślnie zapisano studenta", enr));
            }
            return(BadRequest());
        }
Ejemplo n.º 10
0
        public IActionResult EnrollStudent(EnrollStudentRequest request)
        {
            Enrollment n = _serivce.EnrollStudent(request);

            if (n.Equals(null))
            {
                return(BadRequest(500));
            }
            return(Created("201", n));
        }
Ejemplo n.º 11
0
 public IActionResult AddStudent(EnrollStudentRequest request)
 {
     if (_service.EnrollStudent(request) == null)
     {
         return(BadRequest());
     }
     else
     {
         return(Ok());
     }
 }
Ejemplo n.º 12
0
 public IActionResult EnrollStudent(EnrollStudentRequest request)
 {
     try
     {
         var response = _service.EnrollStudent(request);
         return(Created("", response));
     } catch (Exception ex)
     {
         return(BadRequest(ex));
     }
 }
Ejemplo n.º 13
0
        public IActionResult EnrollStudent(EnrollStudentRequest request)
        {
            EnrollStudentResponse enrollStudentResponse = _dbService.EnrollStudent(request);

            if (enrollStudentResponse == null)
            {
                return(BadRequest());
            }

            return(this.StatusCode(201, enrollStudentResponse));
        }
Ejemplo n.º 14
0
 public IActionResult EnrollStudent(EnrollStudentRequest request)
 {
     try
     {
         Enrollment result = service.EnrollStudent(request);
         return(Created(nameof(result), result));
     } catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Ejemplo n.º 15
0
        public IActionResult EnrollStudent(EnrollStudentRequest request)
        {
            var response = _service.EnrollStudent(request);

            if (response.IndexNumber == null)
            {
                return(BadRequest(response.Message));
            }

            return(CreatedAtAction(nameof(EnrollStudent), response));
        }
Ejemplo n.º 16
0
 public IActionResult EnrollStudent(EnrollStudentDto newStudent)
 {
     try
     {
         return(CreatedAtAction("EnrollStudent", _dbService.EnrollStudent(newStudent)));
     }
     catch (Exception e)
     {
         return(BadRequest("Exception: " + e.Message + "\n" + e.StackTrace));
     }
 }
Ejemplo n.º 17
0
 public IActionResult EnrollStudent(StudentWithStudiesRequest request)
 {
     try
     {
         return(Ok(_service.EnrollStudent(request)));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Ejemplo n.º 18
0
 public IActionResult EnrollStudent(EnrollStudentRequest request)
 {
     try
     {
         return Ok(_dbService.EnrollStudent(request));
     }
     catch (Exception e)
     {
         return BadRequest(e.Message);
     }
 }
Ejemplo n.º 19
0
        public IActionResult EnrollStudent(EnrollStudentRequest request)
        {
            try
            {
                var enr = _service.EnrollStudent(request);

                return(Ok(enr));
            } catch (Exception exc)
            {
                return(BadRequest(exc.ToString()));
            }
        }
Ejemplo n.º 20
0
 public IActionResult EnrollStudent(EnrollmentRequest request)
 {
     try
     {
         var result = _dbService.EnrollStudent(request);
         return(Ok(result));
     }
     catch (Exception e)
     {
         return(BadRequest());
     }
 }
Ejemplo n.º 21
0
 public IActionResult EnrollStudent(EnrollStudentRequest newStudent)
 {
     try
     {
         EnrollStudentResponse resp = _service.EnrollStudent(newStudent);
         return(CreatedAtRoute(new RouteValues(), resp));
     }
     catch (ArgumentException e)
     {
         return(BadRequest(e.Message));
     }
 }
Ejemplo n.º 22
0
        public IActionResult EnrollStudent(Student stud)
        {
            string messege = _service.EnrollStudent(stud);

            if (messege.Equals("OK"))
            {
                return(Ok("ok"));
            }
            else
            {
                return(BadRequest(messege));
            }
        }
Ejemplo n.º 23
0
        public IActionResult EnrollStudent(EnrollmentRequest request)
        {
            EnrollmentRequest helpme = _service.EnrollStudent(request);

            if (helpme == null)
            {
                return(BadRequest());
            }
            else
            {
                return(Ok(helpme));
            }
        }
Ejemplo n.º 24
0
        public IActionResult EnrollStudent(EnrollStudentRequest request)
        {
            EnrollStudentResponse response = dbService.EnrollStudent(request);

            if (response == null)
            {
                return(NotFound("Wrong data was passed"));
            }
            else
            {
                return(StatusCode(201, response));
            }
        }
Ejemplo n.º 25
0
        public IActionResult EnrollStudent(EnrollStudentRequest request)
        {
            var response = _service.EnrollStudent(request);

            if (response != null)
            {
                return(Created("", response));
            }
            else
            {
                return(BadRequest());
            }
        }
        public async Task <IActionResult> EnrollStudent(EnrollStudentRequest req)
        {
            EnrollStudentResponse resp = away _service.EnrollStudent(req);

            if (resp == null)
            {
                return(BadRequest());
            }
            else
            {
                return(this.StatusCode(201, resp));
            }
        }
Ejemplo n.º 27
0
        public IActionResult EnrollStudent(EnrollStudentRequest request)
        {
            EnrollStudentResponse response = null;

            try {
                response = _service.EnrollStudent(request);
            } catch (SqlException e) {
                return(NotFound(e.Message));
            } catch (Exception) {
                return(BadRequest("Studia nie istnieją"));
            }
            return(Created(nameof(response), response));
        }
Ejemplo n.º 28
0
        public IActionResult EnrollStudent(EnrollStudentRequest request)
        {
            Enrollment enrollment = _service.EnrollStudent(request);

            if (enrollment == null)
            {
                return(BadRequest("Blad"));
            }
            else
            {
                return(Ok(enrollment));
            }
        }
Ejemplo n.º 29
0
        public IActionResult Enroll([FromBody] EnrollStudentRequest request)
        {
            Enrollment enr = _dbService.EnrollStudent(request);

            if (enr != null)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }
Ejemplo n.º 30
0
        public IActionResult EnrollStudent(EnrollStudentRequest request)
        {
            Enrollment en;

            try
            {
                en = _dbService.EnrollStudent(request);
            }
            catch (Exception e) {
                return(BadRequest(e.Message));
            }

            return(Created("", en));
        }