public async Task <IEnumerable <TempPostsDto> > GetTempPosts(SearchCriteriaDto searchCriteriaDto, int userId)
        {
            var searchCriteria = this.postsMapper.Configuration.Map <SearchCriteria>(searchCriteriaDto);
            var entities       = await this.userRepository.GetTempPosts(searchCriteria, userId);

            return(this.postsMapper.Configuration.Map <IEnumerable <TempPostsDto> >(entities));
        }
        public async Task <IEnumerable <ComplexityLevelsDto> > GetComplexityLevels(SearchCriteriaDto searchCriteriaDto)
        {
            var searchCriteria = this.postsComplexityMapper.Configuration.Map <SearchCriteria>(searchCriteriaDto);
            var entities       = await this.postsComplexityRepository.GetComplexityLevels(searchCriteria);

            return(this.postsComplexityMapper.Configuration.Map <IEnumerable <ComplexityLevelsDto> >(entities));
        }
        public async Task <IEnumerable <PostTypesDto> > GetPostTypes(SearchCriteriaDto searchCriteriaDto)
        {
            var searchCriteria = this.postsTypeMapper.Configuration.Map <SearchCriteria>(searchCriteriaDto);
            var entities       = await this.postsTypeRepository.GetPostTypes(searchCriteria);

            return(this.postsTypeMapper.Configuration.Map <IEnumerable <PostTypesDto> >(entities));
        }
        public async Task <IEnumerable <PostCategoriesDto> > GetPostCategories(SearchCriteriaDto searchCriteriaDto)
        {
            try
            {
                var searchCriteria = this.postCategoryMapper.Configuration.Map <SearchCriteria>(searchCriteriaDto);
                var entities       = await this.postCategoryRepository.GetPostCategories(searchCriteria);

                return(this.postCategoryMapper.Configuration.Map <IEnumerable <PostCategoriesDto> >(entities));
            }
            catch (Exception error)
            {
            }
            return(null);
        }
        public static T AddCriteria <T>(this T request, SearchCriteriaDto type, string value = "true") where T : ICriteria
        {
            if (value == null)
            {
                return(request);
            }

            if (request.Criteria.CriteriaDtos == null)
            {
                request.Criteria.CriteriaDtos = new List <CriteriaDto>();
            }

            var criteria = request.Criteria.CriteriaDtos.ToList();

            criteria.Add(new CriteriaDto()
            {
                CriteriaValue = value,
                CriteriaType  = type
            });
            request.Criteria.CriteriaDtos = criteria;
            return(request);
        }
 public async Task <IEnumerable <PostStatusDto> > GetPostStatuss([FromQuery] SearchCriteriaDto searchCriteriaDto)
 {
     return(await this.postsStatusService.GetPostStatuss(searchCriteriaDto));
 }
 public async Task <IEnumerable <ComplexityLevelsDto> > GetComplexityLevels([FromQuery] SearchCriteriaDto searchCriteriaDto)
 {
     return(await this.postsComplexityService.GetComplexityLevels(searchCriteriaDto));
 }
 public async Task <IEnumerable <PostCategoriesDto> > GetCategories([FromQuery] SearchCriteriaDto searchCriteriaDto)
 {
     return(await this.postCategoryService.GetPostCategories(searchCriteriaDto));
 }
 public async Task<IEnumerable<TempPostsDto>> GetUserPosts([FromQuery]SearchCriteriaDto searchCriteriaDto, int userId)
 {
     return await this.tempPostsService.GetTempPosts(searchCriteriaDto, userId);
 }
 public async Task <IEnumerable <PostsDto> > GetTopPosts([FromQuery] SearchCriteriaDto searchCriteriaDto, int userId)
 {
     return(await this.postsService.GetTopPosts(searchCriteriaDto));
 }