Exemplo n.º 1
0
        public static async Task <XWinji.Models.LMSDomainCoreModelsSession> Activate_Session(List <System.Net.Cookie> cookies, string SessionId, string _Duration, string _Date)
        {
            var baseAddress     = new Uri(URLs.URL);
            var cookieContainer = new CookieContainer();

            cookies.ForEach(cookieContainer.Add);
            var handler = new HttpClientHandler()
            {
                CookieContainer = cookieContainer
            };

            using (XWinji.LMSWebCore client = new XWinji.LMSWebCore(baseAddress, handler))
            {
                var data = new XWinji.Models.LMSApplicationCoreCommandsActivateSessionCommand
                {
                    Id       = SessionId.ToString(),
                    Date     = DateTime.Parse(_Date),
                    Duration = int.Parse(_Duration)
                };

                var customHeaders = new Dictionary <string, List <string> >();
                customHeaders.Add("X-Requested-With", new List <string>()
                {
                    "XMLHttpRequest"
                }); customHeaders.Add("x-language-header", new List <string>()
                {
                    ""
                });
                var response = await client.SessionApi.ActivateSessionWithHttpMessagesAsync(data, "en", customHeaders);

                return(response.Body);
            }
        }
Exemplo n.º 2
0
        public static async Task <IList <XWinji.Models.LMSDomainCoreModelsSubjectArea> > Get_Subjects(List <System.Net.Cookie> cookies)
        {
            var baseAddress     = new Uri(URLs.URL);
            var cookieContainer = new CookieContainer();

            cookies.ForEach(cookieContainer.Add);
            var handler = new HttpClientHandler()
            {
                CookieContainer = cookieContainer
            };

            using (XWinji.LMSWebCore client = new XWinji.LMSWebCore(baseAddress, handler))
            {
                var customHeaders = new Dictionary <string, List <string> >();
                customHeaders.Add("X-Requested-With", new List <string>()
                {
                    "XMLHttpRequest"
                }); customHeaders.Add("x-language-header", new List <string>()
                {
                    ""
                });
                var response = await client.SubjectApi.GetSubjectsWithHttpMessagesAsync("en", customHeaders);

                return(response.Body);
            }
        }
Exemplo n.º 3
0
        public static async Task <XWinji.Models.LMSDomainCoreModelsCourse> Add_Course_StaticGrade_Subject(List <System.Net.Cookie> cookies, string _CourseName, int _JoiningType, bool _IsAutoAccept, int _CourseType,
                                                                                                          bool _LearningPathEnabled)
        {
            //Retreive available Grades
            var availableGrades = await Grades_APIs.Get_Grades(cookies);

            //Retreive available subjects
            var availableSubjects = await Subjects_APIs.Get_Subjects(cookies);

            var baseAddress     = new Uri(URLs.URL);
            var cookieContainer = new CookieContainer();

            cookies.ForEach(cookieContainer.Add);
            var handler = new HttpClientHandler()
            {
                CookieContainer = cookieContainer
            };

            using (XWinji.LMSWebCore client = new XWinji.LMSWebCore(baseAddress, handler))
            {
                var data = new XWinji.Models.LMSApplicationCoreCommandsAddCourseGroupCommand
                {
                    Name          = _CourseName,
                    GroupAlias    = "regyhg",
                    CourseImageId = "1",
                    GradeId       = int.Parse(availableGrades[1].Id.ToString()),
                    MinGrade      = 0,
                    MaxGrade      = 0,
                    SubjectId     = availableSubjects[3].Id.ToString(),
                    Description   = "string",

                    JoiningType                 = _JoiningType,
                    IsAutoAccept                = _IsAutoAccept,
                    Type                        = _CourseType,
                    IsLearningPathsEnabled      = _LearningPathEnabled,
                    LearningPathTheme           = "",
                    IsShowLearnersProgress      = false,
                    OnBehalfTeacherId           = 0,
                    Status                      = 0,
                    IsCourseGamificationEnabled = true,
                    MaxCapacity                 = 5,
                    Location                    = "Location",
                    IsVideoBased                = false,
                    CompletionCriteria          = 1,
                    IsCertificateEnabled        = true
                };

                var customHeaders = new Dictionary <string, List <string> >();
                customHeaders.Add("X-Requested-With", new List <string>()
                {
                    "XMLHttpRequest"
                }); customHeaders.Add("x-language-header", new List <string>()
                {
                    ""
                });
                var response = await client.CourseApi.AddCourseGroupWithHttpMessagesAsync(data, "en", customHeaders);

                return(response.Body);
            }
        }
Exemplo n.º 4
0
        public static async Task Delete_CourseGroup(List <System.Net.Cookie> cookies, int?CourseGroupId)
        {
            var baseAddress     = new Uri(URLs.URL);
            var cookieContainer = new CookieContainer();

            cookies.ForEach(cookieContainer.Add);
            var handler = new HttpClientHandler()
            {
                CookieContainer = cookieContainer
            };

            using (XWinji.LMSWebCore client = new XWinji.LMSWebCore(baseAddress, handler))
            {
                var data = new XWinji.Models.LMSApplicationCoreCommandsDeleteCourseGroupCommand
                {
                    CourseGroupId = CourseGroupId
                };

                var customHeaders = new Dictionary <string, List <string> >();
                customHeaders.Add("X-Requested-With", new List <string>()
                {
                    "XMLHttpRequest"
                }); customHeaders.Add("x-language-header", new List <string>()
                {
                    ""
                });
                var response = await client.CourseApi.DeleteCourseGroupWithHttpMessagesAsync(data, "en", customHeaders);
            }
        }
Exemplo n.º 5
0
        public static async Task <XWinji.Models.LMSApplicationCoreViewModelJoinCourseViewModel> Join_Course(List <System.Net.Cookie> cookies, string _AccessCode, bool _IsInvited)
        {
            var baseAddress     = new Uri(URLs.URL);
            var cookieContainer = new CookieContainer();

            cookies.ForEach(cookieContainer.Add);
            var handler = new HttpClientHandler()
            {
                CookieContainer = cookieContainer
            };

            using (XWinji.LMSWebCore client = new XWinji.LMSWebCore(baseAddress, handler))
            {
                var data = new XWinji.Models.LMSApplicationCoreCommandsJoinCourseCommand
                {
                    AccessCode = _AccessCode,
                    IsInvited  = _IsInvited
                };

                var customHeaders = new Dictionary <string, List <string> >();
                customHeaders.Add("X-Requested-With", new List <string>()
                {
                    "XMLHttpRequest"
                }); customHeaders.Add("x-language-header", new List <string>()
                {
                    ""
                });
                var response = await client.CourseApi.JoinCourseWithHttpMessagesAsync(data, "en", customHeaders);

                return(response.Body);
            }
        }
Exemplo n.º 6
0
        public static async Task <XWinji.Models.LMSApplicationCoreViewModelUserViewModel> Get_UserInfo(List <System.Net.Cookie> cookies)
        {
            var baseAddress     = new Uri(URLs.URL);
            var cookieContainer = new CookieContainer();

            cookies.ForEach(cookieContainer.Add);
            var handler = new HttpClientHandler()
            {
                CookieContainer = cookieContainer
            };

            using (XWinji.LMSWebCore client = new XWinji.LMSWebCore(baseAddress, handler))
            {
                var data = new XWinji.Models.LMSApplicationCoreViewModelUserBasicInfoViewModel
                {
                };

                var customHeaders = new Dictionary <string, List <string> >();
                customHeaders.Add("X-Requested-With", new List <string>()
                {
                    "XMLHttpRequest"
                }); customHeaders.Add("x-language-header", new List <string>()
                {
                    ""
                });
                var response = await client.UserApi.GetCurrentUserInfoWithHttpMessagesAsync(customHeaders);

                return(response.Body);
            }
        }
Exemplo n.º 7
0
        public static async Task <XWinji.Models.LMSApplicationCoreViewModelSessionViewModel> Add_Session(List <System.Net.Cookie> cookies, string _Title, string _Objectives, string _Duration, int?_RoundID, string _Date)
        {
            var baseAddress     = new Uri(URLs.URL);
            var cookieContainer = new CookieContainer();

            cookies.ForEach(cookieContainer.Add);
            var handler = new HttpClientHandler()
            {
                CookieContainer = cookieContainer
            };

            using (XWinji.LMSWebCore client = new XWinji.LMSWebCore(baseAddress, handler))
            {
                var data = new XWinji.Models.LMSApplicationCoreCommandsSessionAddCommand
                {
                    Title           = _Title,
                    Objective       = _Objectives,
                    Duration        = int.Parse(_Duration),
                    CourseId        = _RoundID,
                    Date            = DateTime.Parse(_Date),
                    VoiceNotefileId = null
                };

                var customHeaders = new Dictionary <string, List <string> >();
                customHeaders.Add("X-Requested-With", new List <string>()
                {
                    "XMLHttpRequest"
                }); customHeaders.Add("x-language-header", new List <string>()
                {
                    ""
                });
                var response = await client.CourseApi.AddSessionWithHttpMessagesAsync(data, "en", customHeaders);

                return(response.Body);
            }
        }
Exemplo n.º 8
0
        public static async Task Delete_CourseMember(List <System.Net.Cookie> cookies, int?courseId, int?StudentId)
        {
            var baseAddress     = new Uri(URLs.URL);
            var cookieContainer = new CookieContainer();

            cookies.ForEach(cookieContainer.Add);
            var handler = new HttpClientHandler()
            {
                CookieContainer = cookieContainer
            };

            using (XWinji.LMSWebCore client = new XWinji.LMSWebCore(baseAddress, handler))
            {
                var customHeaders = new Dictionary <string, List <string> >();
                customHeaders.Add("X-Requested-With", new List <string>()
                {
                    "XMLHttpRequest"
                }); customHeaders.Add("x-language-header", new List <string>()
                {
                    ""
                });
                var response = await client.CourseApi.RemoveMemberFromCourseByIdWithHttpMessagesAsync(int.Parse(StudentId.ToString()), int.Parse(courseId.ToString()), "en", null, customHeaders);
            }
        }