public Task<List<IQuestionType>> GetCollectionAsync(PagingParams pagingParams) { if (pagingParams == null) { pagingParams = new PagingParams(); } return questionTypeRepository.GetCollectionAsync(pagingParams); }
public Task<List<ITestingArea>> GetCollectionAsync(PagingParams pagingParams) { if (pagingParams == null) { pagingParams = new PagingParams(); } return testingAreaRepository.GetCollectionAsync(pagingParams); }
public async Task<List<dynamic>> GetPageWithQuestionsAndTestingAreaAsync(PagingParams pagingParams) { var exams = await examRepository.GetPageWithQuestionsAndTestingAreaAsync(pagingParams); return exams.Select(exam => (dynamic)new { Id = exam.Id, DurationInMinutes = exam.DurationInMinutes, NumberOfQuestions = exam.ExamQuestions.Count, Title = String.Format("{0} ({1} {2}.)", exam.TestingArea.Title, ExamTerms.GetExamTermName(exam.Term), exam.Year) }).ToList(); }
public async Task<List<IQuestionType>> GetCollectionAsync(PagingParams pagingParams) { var questionTypes = repository.FetchCollection<QuestionTypeEntity>() .OrderBy(!String.IsNullOrEmpty(pagingParams.SortByField) ? pagingParams.SortByField : QuestionTypeFields.Title); if (pagingParams.PageSize > 0) { questionTypes.Skip((pagingParams.PageNumber - 1) * pagingParams.PageSize) .Take(pagingParams.PageSize); } return Mapper.Map<List<IQuestionType>>(await questionTypes.ToListAsync()); }
public async Task<List<IExam>> GetCollectionAsync(PagingParams pagingParams) { var exams = repository.FetchCollection<ExamEntity>() .OrderBy(!String.IsNullOrEmpty(pagingParams.SortByField) ? pagingParams.SortByField : String.Format("{0},{1},{2}", ExamFields.TestingAreaId, ExamFields.Year, ExamFields.Id)); if (pagingParams.PageSize > 0) { exams.Skip((pagingParams.PageNumber - 1) * pagingParams.PageSize) .Take(pagingParams.PageSize); } return Mapper.Map<List<IExam>>(await exams.ToListAsync()); }
public async Task<List<ITestingArea>> GetCollectionAsync(PagingParams pagingParams) { var testingAreas = repository.FetchCollection<TestingAreaEntity>() .OrderBy(!String.IsNullOrEmpty(pagingParams.SortByField) ? pagingParams.SortByField : TestingAreaFields.Title); if (pagingParams.PageSize > 0) { testingAreas.Skip((pagingParams.PageNumber - 1) * pagingParams.PageSize) .Take(pagingParams.PageSize); } return Mapper.Map<List<ITestingArea>>(await testingAreas.ToListAsync()); }
public async Task<List<IRole>> GetCollectionAsync(PagingParams pagingParams) { var roles = repository.FetchCollection<RoleEntity>() .OrderBy(!String.IsNullOrEmpty(pagingParams.SortByField) ? pagingParams.SortByField : RoleFields.Name); if (pagingParams.PageSize > 0) { roles.Skip((pagingParams.PageNumber - 1) * pagingParams.PageSize) .Take(pagingParams.PageSize); } return Mapper.Map<List<IRole>>(await roles.ToListAsync()); }
public async Task<List<dynamic>> GetPageAsync(PagingParams pagingParams) { var questions = await questionRepository.GetPageAsync(pagingParams); return questions.Select(question => (dynamic)new { Id = question.Id, TextPreview = question.Text.Length < 100 ? question.Text : question.Text.Substring(0, 100), QuestionType = question.QuestionType.Title, Points = question.AnswerChoices.Sum(choice => choice.Points), Term = String.Format("{0} {1}.", ExamTerms.GetExamTermName(question.ExamQuestions.ElementAt(0).Exam.Term), question.ExamQuestions.ElementAt(0).Exam.Year), Area = question.ExamQuestions.ElementAt(0).TestingArea.Title }).ToList(); }
public async Task<List<IExamParams>> GetPageWithQuestionsAndTestingAreaAsync(PagingParams pagingParams) { var exams = repository.FetchCollection<ExamEntity>() .OrderBy(!String.IsNullOrEmpty(pagingParams.SortByField) ? pagingParams.SortByField : String.Format("{0},{1},{2}", ExamFields.TestingAreaId, ExamFields.Year, ExamFields.Id)); if (pagingParams.PageSize > 0) { exams.Skip((pagingParams.PageNumber - 1) * pagingParams.PageSize) .Take(pagingParams.PageSize); } exams.Include(exam => exam.TestingArea) .Include(exam => exam.ExamQuestions.Select(eq => eq.Question)); return Mapper.Map<List<IExamParams>>(await exams.ToListAsync()); }
public async Task<dynamic> GetApplicationData(string userId) { var pagingParams = new PagingParams(); var role = await roleRepository.GetByUserId(userId); var testingAreas = await testingAreaRepository.GetCollectionAsync(pagingParams); var questionTypes = await questionTypeRepository.GetCollectionAsync(pagingParams); return (dynamic)new { Role = role.Name, TestingAreas = testingAreas, QuestionTypes = questionTypes }; }
public async Task<List<IQuestionParams>> GetPageAsync(PagingParams pagingParams) { var questions = repository.FetchCollection<QuestionEntity>() .OrderBy(!String.IsNullOrEmpty(pagingParams.SortByField) ? pagingParams.SortByField : String.Format("{0},{1}", QuestionFields.QuestionTypeId, QuestionFields.Id)); if (pagingParams.PageSize > 0) { questions.Skip((pagingParams.PageNumber - 1) * pagingParams.PageSize) .Take(pagingParams.PageSize); } questions.Include(question => question.QuestionType) .Include(question => question.AnswerChoices) .Include(question => question.ExamQuestions.Select(eq => eq.Exam.TestingArea)); return Mapper.Map<List<IQuestionParams>>(await questions.ToListAsync()); }
public async Task<HttpResponseMessage> GetDatasetAsync(PagingParams pagingParams) { var result = await testingAreaService.GetCollectionAsync(pagingParams); return Request.CreateResponse(HttpStatusCode.OK, result); }
public async Task<HttpResponseMessage> GetPageAsync(PagingParams pagingParams) { var examList = await examService.GetPageWithQuestionsAndTestingAreaAsync(pagingParams); return Request.CreateResponse(HttpStatusCode.OK, examList); }
public async Task<HttpResponseMessage> GetPageAsync(PagingParams pagingParams) { var questionTypeList = await questionTypeService.GetCollectionAsync(pagingParams); return Request.CreateResponse(HttpStatusCode.OK, questionTypeList); }
public Task<List<IExam>> GetCollectionAsync(PagingParams pagingParams) { return examRepository.GetCollectionAsync(pagingParams); }
public async Task<HttpResponseMessage> GetCollectionAsync(PagingParams pagingParams) { return Request.CreateResponse(HttpStatusCode.OK, await roleService.GetCollectionAsync(pagingParams)); }