public async Task <KeyValuePair <string, HttpStatusCode> > VerifyPostAsync(string username,
                                                                                   int questionId, string answerToSecretQuestion)
        {
            object user = default;
            var    body = JsonController.ConvertObjectToJson(user);

            return(await AppServicesController.Request(Links.VerifySecretQuestion + "userName="******"&questionId=" + questionId + "&answer=" + answerToSecretQuestion, body));
        }
        public static async Task <KeyValuePair <string, HttpStatusCode> > ResetPassword(string newPassword, string userName)
        {
            var newpassword = new ForgotPasswordModel
            {
                Password = newPassword,
                UserName = userName,
            };
            var body = JsonController.ConvertObjectToJson(newpassword);

            return(await AppServicesController.Request(Links.ResetPassword, body));
        }
Example #3
0
        private async Task <KeyValuePair <string, HttpStatusCode> > saveMarks()
        {
            string body = "";
            string link = "";

            if (_title == CrossLocalization.Translate("practice_mark"))
            {
                link = Links.SaveSinglePract;
                SavePractSingle save = new SavePractSingle();
                foreach (var pract in _takedLabs.Practicals.Where(v => v.ShortName == SelectedShortName))
                {
                    save.practicalId = pract.PracticalId;
                    foreach (var practic in fullPractice.Students.Where(v => v.FullName == studentName))
                    {
                        save.studentId      = practic.StudentId;
                        save.showForStudent = ShowForStud;
                        save.mark           = Mark;
                        save.Comment        = Comment;
                        save.date           = DateTime.Today.ToString("dd.MM.yyyy");
                        foreach (var practMark in practic.PracticalsMarks.Where(v => v.PracticalId == save.practicalId))
                        {
                            save.id = practMark.StudentPracticalMarkId;
                        }
                    }
                }
                body = JsonController.ConvertObjectToJson(save);
            }
            else if (_title == CrossLocalization.Translate("stats_page_labs_rating"))
            {
                link = Links.SaveSingleLab;
                SaveLabsSingle save = new SaveLabsSingle();
                foreach (var lab in _takedLabs.Labs.Where(v => v.ShortName == SelectedShortName && v.SubGroup == _subGruop))
                {
                    save.labId = lab.LabId;
                    foreach (var labs in fullMarksLabs.Students.Where(v => v.FullName == studentName))
                    {
                        save.studentId      = labs.StudentId;
                        save.showForStudent = ShowForStud;
                        save.mark           = Mark;
                        save.Comment        = Comment;
                        save.date           = DateTime.Today.ToString("dd.MM.yyyy");
                        foreach (var labMark in labs.LabsMarks.Where(v => v.LabId == save.labId))
                        {
                            save.id = labMark.StudentLabMarkId;
                        }
                    }
                }
                body = JsonController.ConvertObjectToJson(save);
            }
            await _services.Navigation.ClosePage(false);

            return(await AppServicesController.Request(link, body));
        }
        public async Task <KeyValuePair <string, HttpStatusCode> > RegistrationPostAsync(string username, string name, string surname, string patronymic, string password, string confirmPassword,
                                                                                         int group, int questionId, string answerToSecretQuestion)
        {
            var registerUser = new RegistrationModel
            {
                Name                   = name,
                Surname                = surname,
                Patronymic             = patronymic,
                UserName               = username,
                Password               = password,
                ConfirmPassword        = confirmPassword,
                Group                  = group,
                QuestionId             = questionId,
                AnswerToSecretQuestion = answerToSecretQuestion,
            };

            var body = JsonController.ConvertObjectToJson(registerUser);

            return(await AppServicesController.Request(Links.Registration, body));
        }
Example #5
0
        public async Task PostRequestTest()
        {
            var response = await AppServicesController.Request(_apiURL, "body");

            Assert.AreEqual(HttpStatusCode.BadRequest, response.Value);
        }
Example #6
0
 public async Task <KeyValuePair <string, HttpStatusCode> > VerifyUserNameAsync(string username)
 {
     return(await AppServicesController.Request(Links.VerifyUserExists + "userName=" + username));
 }
Example #7
0
        private async Task <KeyValuePair <string, HttpStatusCode> > saveMarks()
        {
            string link = "";
            string body = "";

            if (_titleOfPage == CrossLocalization.Translate("stats_page_lectures_visiting"))
            {
                var lecturesVisiting = fullVisitingLectures.GroupsVisiting[0];
                link = Links.SaveLecturesCalendarData;
                var i = 0;
                foreach (var lect in lecturesVisiting.LecturesMarksVisiting)
                {
                    for (int m = 0; m < lect.Marks.Count; m++)
                    {
                        if (lect.Marks[m].Date == selDateForSave)
                        {
                            lect.Marks[m].Mark    = _currentLecturesVisitingMarks[i].Mark;
                            lect.Marks[m].Comment = _currentLecturesVisitingMarks[i].Comment;
                            //lect.Marks[m]. = _currentLecturesVisitingMarksReady[i].ShowForStud;
                            i++;
                        }
                        ;
                    }
                    ;
                }
                ;
                SaveLectures lecturesMarks = new SaveLectures();
                lecturesMarks.lecturesMarks = lecturesVisiting.LecturesMarksVisiting;
                body = JsonController.ConvertObjectToJson(lecturesMarks);
            }
            else if (_titleOfPage == CrossLocalization.Translate("stats_page_labs_visiting"))
            {
                var      labsVisiting = fullVisitingLabs.Students;
                SaveLabs labsMarks    = new SaveLabs();
                int      dateId       = 0;
                foreach (var lab in _takedLabs.ScheduleProtectionLabs.Where(v => v.Date == selLabDateForSave && v.SubGroup == selSubGroup))
                {
                    dateId = lab.ScheduleProtectionLabId;
                }
                int i = 0;
                for (int stud = 0; stud < labsVisiting.Count; stud++)
                {
                    if (labsVisiting[stud].FullName == LabsVisitingMarksSubGroup[i].Title)
                    {
                        foreach (var mark in labsVisiting[stud].LabVisitingMark.Where(v => v.ScheduleProtectionLabId == dateId))
                        {
                            mark.Mark    = LabsVisitingMarksSubGroup[i].Mark;
                            mark.Comment = LabsVisitingMarksSubGroup[i].Comment;
                            labsMarks.comments.Add(LabsVisitingMarksSubGroup[i].Comment);
                            labsMarks.Id.Add(mark.LabVisitingMarkId);
                            labsMarks.marks.Add(mark.Mark);
                            labsMarks.showForStudents.Add(LabsVisitingMarksSubGroup[i].ShowForStud);
                            labsMarks.studentsId.Add(labsVisiting[stud].StudentId);
                        }
                        ;
                        labsMarks.students.Add(labsVisiting[stud]);
                        i++;
                        if (i == LabsVisitingMarksSubGroup.Count)
                        {
                            break;
                        }
                    }
                    ;
                }
                ;
                link             = Links.SaveLabsMark;
                labsMarks.dateId = dateId;
                body             = JsonController.ConvertObjectToJson(labsMarks);
            }
            else if (_titleOfPage == CrossLocalization.Translate("practiсe_visiting"))
            {
                var            dateId         = 0;
                SavePracticial savePracticial = new SavePracticial();
                var            practVisiting  = fullVisitingPract.Students;
                link = Links.SaveStudentPracticalMark;
                foreach (var pr in _takedLabs.ScheduleProtectionPracticals.Where(v => v.Date == selDateForSave))
                {
                    dateId = pr.ScheduleProtectionPracticalId;
                }
                int i = 0;
                for (int pract = 0; pract < practVisiting.Count; pract++)
                {
                    foreach (var mark in practVisiting[pract].PracticalVisitingMark.Where(v => v.ScheduleProtectionPracticalId == dateId))
                    {
                        mark.Mark    = LecturesMarks[i].Mark;
                        mark.Comment = LecturesMarks[i].Comment;
                        savePracticial.Id.Add(mark.PracticalVisitingMarkId);
                        savePracticial.marks.Add(mark.Mark);
                        savePracticial.showForStudents.Add(LecturesMarks[i].ShowForStud);
                        savePracticial.studentsId.Add(practVisiting[pract].StudentId);
                        savePracticial.Comments.Add(LecturesMarks[i].Comment);
                    }
                    savePracticial.students.Add(practVisiting[pract]);
                    i++;
                }
                savePracticial.dateId    = dateId;
                savePracticial.subjectId = subjectId;
                body = JsonController.ConvertObjectToJson(savePracticial);
            }
            await _services.Navigation.ClosePage(false);

            return(await AppServicesController.Request(link, body));
        }