public IActionResult PromoteStudents(PromoteStudentsRequest request) { var response = _service.PromoteStudents(request); if (response != null) { return(Ok(response)); } return(NotFound()); }
public IActionResult PromoteStudents(PromoteStudentRequest request) { var response = _service.PromoteStudents(request); if (response is null) { return(BadRequest()); } return(CreatedAtAction(nameof(PromoteStudents), response)); }
public IActionResult PromoteStudents(String Studies, int Semester) { _service.PromoteStudents(Studies, Semester); var response = new EnrollStudentResponse() { Studies = Studies, semester = ++Semester }; return(CreatedAtAction(nameof(EnrollStudent), response)); }
public IActionResult PromoteStudent(PromoteStudentRequest request) { try { var response = _service.PromoteStudents(request); return(Created("PromoteStudent", response)); } catch (Exception e) { return(BadRequest(e.Message)); } }
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")); } }
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()); }
public IActionResult PromoteStudents() { _service.PromoteStudents(1, "IT"); return(Ok()); }