public IActionResult PromotionStudent(PromotionStudentsReq req)
 {
     try
     {
         StudyEnrollment enroll = _dbService.PromotionStudents(req);
         String          uris   = $"/api/enrollments/{enroll.IdEnrollment}";
         return(Created(uris, enroll));
     }
     catch (StudyEnrollmentNotFoundException)
     {
         return(NotFound());
     }
 }
        public StudyEnrollment PromotionStudents(PromotionStudentsReq req)
        {
            using (var conn = new SqlConnection(SqlConnect))
                using (var cmd = new SqlCommand())
                {
                    conn.Open();
                    cmd.Connection = conn;

                    FindEnrollmentBySemesterAndStudies(cmd, req.Studies, req.Semester);

                    cmd.CommandText = @"PromotionStudents";
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@Studies", req.Studies);
                    cmd.Parameters.AddWithValue("@Semester", req.Semester);
                    cmd.Parameters.AddWithValue("@NewIdEnrollment", 0);
                    cmd.ExecuteNonQuery();

                    int newSemester = req.Semester + 1;

                    return(FindEnrollmentBySemesterAndStudies(cmd, req.Studies, newSemester));
                }
        }