Example #1
0
        public async Task <ApiResponse <List <CompetidoresGetDto> > > GetByAllFilter(CompetidoresQueryFilter filter)
        {
            List <CompetidoresGetDto> resultDto = new List <CompetidoresGetDto>();

            Metadata metadata = new Metadata
            {
                IsValid = true,
                Message = ""
            };


            ApiResponse <List <CompetidoresGetDto> > response = new ApiResponse <List <CompetidoresGetDto> >(resultDto);

            var motivos = await _unitOfWork.CompetidoresRepository.GetAllByFilter(filter);


            resultDto = _mapper.Map <List <CompetidoresGetDto> >(motivos);

            response.Data = resultDto;
            response.Meta = metadata;
            return(response);
        }
        public async Task <List <Wsmy383> > GetAllByFilter(CompetidoresQueryFilter filter)
        {
            List <Wsmy383> result = new List <Wsmy383>();


            if (filter.CodCompetidor > 0)
            {
                result = await _context.Wsmy383.Where(x => x.CodCompetidor == filter.CodCompetidor).ToListAsync();
            }


            if (filter.SearchText == "")
            {
                result = await _context.Wsmy383.ToListAsync();
            }
            if (filter.SearchText != "")
            {
                result = await _context.Wsmy383.Where(x => x.Nombre.Trim().ToLower().Contains(filter.SearchText.Trim().ToLower())).ToListAsync();
            }

            return(result);
        }
        public async Task <IActionResult> GetByAllFilter(CompetidoresQueryFilter filters)
        {
            var response = await _competidoresService.GetByAllFilter(filters);

            return(Ok(response));
        }