public AddOrEditTestViewModel(PageService pageService, TestsRestClient testsClient) { _pageService = pageService; _testsClient = testsClient; if (!IsAdding) { if (TestId != null) { var test = HttpResponseMessageConverter.GetResult <dynamic>(_testsClient.GetTestById((int)TestId)); Duration = test.duration; MaximumNumberOfQuestions = test.maximumNumberOfQuestions; Name = test.name; Description = test.description; StartDate = test.startDate; StartTime = test.startDate; ExpirationDate = test.expirationDate; ExpirationTime = test.expirationDate; } } }
public PassingTheTestViewModel(PageService pageService, UserService userService, TestsRestClient testsClient, AnswersRestClient answersClient, StudentsRestClient studentsClient, QuestionsRestClient questionsClient, StudentAnswersRestClient studentAnswersClient) { _pageService = pageService; _userService = userService; _testsClient = testsClient; _answersClient = answersClient; _studentsClient = studentsClient; _questionsClient = questionsClient; _studentAnswersClient = studentAnswersClient; if (TestId != null) { Test = HttpResponseMessageConverter.GetResult <dynamic>(_testsClient.GetTestById((int)TestId)); InitTimer(); FormQuestions(); ActiveQuestion = Questions[0]; Answers.Clear(); Answers = new ObservableCollection <dynamic>(HttpResponseMessageConverter.GetResult <List <dynamic> >(_answersClient.GetAnswersByQuestionId(Convert.ToInt32(ActiveQuestion.id)))); } }