Exemplo n.º 1
0
        public static void AddUser(long modality, string apiUsername, long moodleUserId)
        {
            if (Users == null)
            {
                Users = new ConcurrentBag <MoodleCacheValues>();
            }

            bool success = Users.Where(x => x.ApiIdentifier == apiUsername && x.Modality == modality).Count() > 0;

            if (success)
            {
                return;
            }

            MoodleCacheValues values = new MoodleCacheValues();

            values.Modality      = modality;
            values.ApiIdentifier = apiUsername;
            values.MoodleId      = moodleUserId;
            values.Type          = MoodleCachaValueType.User;

            Users.Add(values);
        }
Exemplo n.º 2
0
        public static void AddCourse(long modality, string apiDisciplineName, long moodleCourseId)
        {
            if (Courses == null)
            {
                Courses = new ConcurrentBag <MoodleCacheValues>();
            }

            bool success = Courses.Where(x => x.ApiIdentifier == apiDisciplineName && x.Modality == modality).Count() > 0;

            if (success)
            {
                return;
            }

            MoodleCacheValues values = new MoodleCacheValues();

            values.Modality      = modality;
            values.ApiIdentifier = apiDisciplineName;
            values.MoodleId      = moodleCourseId;
            values.Type          = MoodleCachaValueType.Course;

            Courses.Add(values);
        }