コード例 #1
0
ファイル: EnrollmentsController.cs プロジェクト: s18665/APBD7
        public IActionResult PromoteStudents(PromoteStudentsRequest request)
        {
            var response = _service.PromoteStudents(request);

            if (response != null)
            {
                return(Ok(response));
            }
            return(NotFound());
        }
コード例 #2
0
        public IActionResult PromoteStudents(PromoteStudentRequest request)
        {
            var response = _service.PromoteStudents(request);

            if (response is null)
            {
                return(BadRequest());
            }

            return(CreatedAtAction(nameof(PromoteStudents), response));
        }
コード例 #3
0
ファイル: EnrollmentController.cs プロジェクト: s19047/APBD_5
        public IActionResult PromoteStudents(String Studies, int Semester)
        {
            _service.PromoteStudents(Studies, Semester);
            var response = new EnrollStudentResponse()
            {
                Studies  = Studies,
                semester = ++Semester
            };

            return(CreatedAtAction(nameof(EnrollStudent), response));
        }
コード例 #4
0
 public IActionResult PromoteStudent(PromoteStudentRequest request)
 {
     try
     {
         var response = _service.PromoteStudents(request);
         return(Created("PromoteStudent", response));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
コード例 #5
0
ファイル: EnrollmentsController.cs プロジェクト: mruzova/APBD
 public IActionResult PromoteStudents(PromoteStudentRequest request)
 {
     try
     {
         var response = _service.PromoteStudents(request);
         return(Created("PromoteStudents", response));
     }
     catch (SqlException)
     {
         return(BadRequest("there are no students to promote or no such study"));
     }
 }
コード例 #6
0
        public IActionResult PromoteStudents(PromoteStudentRequest request)
        {
            //Request - name of studies=IT, semester=1

            //1. Check if studies exists
            //2. Find all the students from studies=IT and semester=1
            //3. Promote all students to the 2 semester
            //   Find an enrollment record with studies=IT and semester=2    -> IdEnrollment=10
            //   Update all the students
            //   If Enrollment does not exist -> add new one

            //Create stored procedure
            try
            {
                _service.PromoteStudents(request.Semester, request.Studies);
            }
            catch (HttpException e)
            {
                return(NotFound(e.ToString()));
            }
            return(Ok());
        }
コード例 #7
0
ファイル: EnrollmentController.cs プロジェクト: s16500/tut5
        public IActionResult PromoteStudents()
        {
            _service.PromoteStudents(1, "IT");

            return(Ok());
        }