protected IQuery <AnswerDTO> CreateQuery(QuestionFilter filter) { var query = AnswerListQuery; query.Filter = filter; return(query); }
protected IQuery <QuestionDTO> CreateQuery(QuestionFilter filter) { var query = QuestionListQuery; query.Filter = filter; return(query); }
public async Task <IActionResult> GetFilteredList(QuestionFilter filter) { var result = await _questionBankService.FilteredListAsync(filter); var resultDTO = _mapper.Map <IEnumerable <QuestionDTO> >(result.Questions); return(Ok(resultDTO)); }
public async Task <QuestionResponse> FilteredListAsync(QuestionFilter filter) { var filteredQuestions = _questionRepository.QueryableData() .SpecializationFilter(filter.SpecializationID) .FiledFilter(filter.FiledID); return(new QuestionResponse(await filteredQuestions.ToListAsync())); }
public async Task <IActionResult> GetFilteredListPage(QuestionFilter filter, int pageIndex, int pageSize) { var result = await _questionBankService.FilteredListAsync(filter); var resultDTO = _mapper.Map <IEnumerable <QuestionDTO> >(result.Questions); var page = new PaginatedResponse <QuestionDTO>(resultDTO, pageIndex, pageSize); return(Ok(page.Data)); }
public async Task <IEnumerable <QuestionEntity> > GetQuestionsAsync(QuestionFilter filter, CancellationToken cancellationToken = default(CancellationToken)) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); var entitiesQuery = ApplyFilter(Entities, filter); var result = await entitiesQuery .Include(t => t.Answers) .ToListAsync(cancellationToken); return(result); }
// GET: Questions public virtual ActionResult QuestionList(QuestionFilter questionFilter = null) { var questionList = new QuestionListViewModel { TaskId = questionFilter.TaskId.Value, TaskName = TaskService.GetById(questionFilter.TaskId.Value).Title }; var questions = QuestionService.GetAll(Query.ForQuestion(questionFilter).Include(x => x.Answers())).Decorate<Question, QuestionViewModel>(); questionList.AddRange(questions); return PartialView(MVC.Questions.Views._QuestionList, questionList); }
public async Task <IActionResult> Get([FromBody] QuestionFilter model) { if (model.LawyerQuestions) { var userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; var user = await UserManager.FindByIdAsync(userId); model.LawyerId = user.LawyerId; } var res = QuestionService.Get(model); return(Ok(res)); }
public IEnumerable<Question> FindQuestions(QuestionSearchCriteria criteria) { var filter = new QuestionFilter(criteria); return filter.Select(Entities.Questions); //return criteria.Disciplines != null // ? from question in Entities.Questions // where // question.Title.Contains(criteria.Keyword) && // question.Disciplines.Any(d => criteria.Disciplines.Contains(d.Id)) // orderby question.PostedDate descending // select question // : from question in Entities.Questions // where // question.Title.Contains(criteria.Keyword) // orderby question.PostedDate descending // select question; }
public IEnumerable <Question> FindQuestions(QuestionSearchCriteria criteria) { var filter = new QuestionFilter(criteria); return(filter.Select(Entities.Questions)); //return criteria.Disciplines != null // ? from question in Entities.Questions // where // question.Title.Contains(criteria.Keyword) && // question.Disciplines.Any(d => criteria.Disciplines.Contains(d.Id)) // orderby question.PostedDate descending // select question // : from question in Entities.Questions // where // question.Title.Contains(criteria.Keyword) // orderby question.PostedDate descending // select question; }
public async Task <IEnumerable <Question> > GetQuestionsAsync(int from, int toTake) { ThrowIfDisposed(); QuestionFilter filter = new QuestionFilter { From = from, ToTake = toTake, IsClosed = false, IsVerified = true }; IEnumerable <QuestionEntity> questions = await QuestionRepository.GetQuestionsAsync(filter, CancellationToken); var questionsResult = Mapper.Map <IEnumerable <QuestionEntity>, IEnumerable <Question> >(questions); return(questionsResult); }
public IEnumerable <QuestionDTO> Get(QuestionFilter questionfilter) { Expression <Func <Question, bool> > filter = s => s.Title != null; if (questionfilter.CategoryId.HasValue) { Expression <Func <Question, bool> > filterToAppend = s => s.CategoryId == questionfilter.CategoryId; filter = filter.And(filterToAppend); } if (questionfilter.LawyerQuestions) { Expression <Func <Question, bool> > filterToAppend = s => s.Answers.Any(w => w.User.LawyerId == questionfilter.LawyerId); filter = filter.And(filterToAppend); } if (questionfilter.UnAnswerd) { Expression <Func <Question, bool> > filterToAppend = s => !s.Answers.Any(); filter = filter.And(filterToAppend); } return(QuestionRepository.Get(filter, includeProperties: "User,Answers,Answers.User").Select(s => QuestionDTO.ToQuestionDTO(s))); }
public GetTestResultByTestIdQuery(QuestionFilter filter) { Filter = filter; }
public GetTestQuestionOptionForEndUserByTestId(QuestionFilter filter) { Filter = filter; }
public async Task <IActionResult> GetTestResultByTestId([FromQuery] QuestionFilter filter) { var result = await _mediator.Send(new GetTestResultByTestIdQuery(filter)); return(result); }
public GetQuestionFilterQuery(QuestionFilter filter) { Filter = filter; }
public async Task <IActionResult> GetAllUser([FromQuery] QuestionFilter filter) { var result = await _mediator.Send(new GetAllTestUserQuery(filter)); return(result); }
public GetAllTestUserQuery(QuestionFilter filter) { Filter = filter; }
public async Task <IActionResult> GetQuestionById([FromQuery] QuestionFilter query) { var result = await _mediator.Send(new GetQuestionOptionByIdQuery(query)); return(result); }
public async Task <IActionResult> GetQuestionCountbyCategoryId([FromQuery] QuestionFilter filter) { var result = await _mediator.Send(new GetQuestionCountQuery(filter)); return(result); }
protected IQueryable <QuestionEntity> ApplyFilter(IQueryable <QuestionEntity> entities, QuestionFilter filter) { if (filter.IsClosed.HasValue) { entities = entities.Where(t => t.IsClosed == filter.IsClosed.Value); } if (filter.IsVerified.HasValue) { entities = entities.Where(t => t.IsVerified == filter.IsVerified.Value); } if (filter.From.HasValue || filter.ToTake.HasValue) { entities = entities.OrderBy(t => t.CreateDateTimeUTC); if (filter.From.HasValue) { entities = entities.Skip(filter.From.Value); } if (filter.ToTake.HasValue) { entities = entities.Take(filter.ToTake.Value); } } return(entities); }
public GetTestByCategoryId(QuestionFilter filter) { Filter = filter; }
public async Task <IActionResult> GetTraningDocument([FromQuery] QuestionFilter filter) { var result = await _mediator.Send(new GetTestQuestionOptionForEndUserByTestId(filter)); return(result); }
public async Task <IActionResult> GetEndUserTests([FromQuery] QuestionFilter filter) { var result = await _mediator.Send(new GetTestsForEndUser()); return(result); }
public GetQuestionOptionByIdQuery(QuestionFilter filter) { Filter = filter; }