コード例 #1
0
 public static void UnAssignUsersToSubArea(int[] studentsIds, SubAreaController subAreaController, int subAreaId)
 {
     foreach (int studentId in studentsIds)
     {
         StudentTeacherProxy.UpdateStudent(studentId);
         int subAreaAssignId = subAreaController.GetAssignmentId(subAreaId, studentId);
         subAreaController.DeleteAssignment(subAreaAssignId);
     }
 }
コード例 #2
0
 public static void AssignUsersToSubArea(int[] usersIds, SubAreaController subAreaController, int subAreaId)
 {
     foreach (int userId in usersIds)
     {
         StudentTeacherProxy.UpdateStudent(userId);
         SubAreaAssign newAssignment = new SubAreaAssign
         {
             userId    = userId,
             created   = DateTime.Today,
             subAreaId = subAreaId
         };
         subAreaController.AssignNewSubArea(newAssignment);
     }
 }
コード例 #3
0
        public ActionResult Get(int id) //This method does NOT differentiate between any role
        {
            var result = studentTeacherProxy.GetStudent(id);

            if (result == null)
            {
                EditStudentController.currentStudent = null;
                EditStudentController.Editing        = false;
                return(NotFound());
            }
            StudentTeacherProxy.UpdateStudent(result);
            EditStudentController.currentStudent = result;
            EditStudentController.Editing        = true;
            return(Ok(result));
        }
コード例 #4
0
        private void ChangeSubAreaUsers(int subAreaId, User[] actualStudents, User[] actualTeachers)
        {
            List <int> oldSubAreaUsers = subAreaController.GetAllStudentsIds(subAreaId);

            foreach (int userId in oldSubAreaUsers)
            {
                StudentTeacherProxy.UpdateStudent(userId);
            }
            List <int> actualUsersIds = UserUtils.UserToUserIds(actualStudents.Concat(actualTeachers).ToArray());
            List <int> usersToAssign  = UserUtils.OneWayCompareUsers(actualUsersIds, oldSubAreaUsers);
            List <int> usersToDelete  = UserUtils.OneWayCompareUsers(oldSubAreaUsers, actualUsersIds);

            SubAreaAssignUtils.AssignUsersToSubArea(usersToAssign.ToArray(), subAreaController, subAreaId);
            SubAreaAssignUtils.UnAssignUsersToSubArea(usersToDelete.ToArray(), subAreaController, subAreaId);
        }