public IActionResult PaginateSorting([FromBody] DtoPaginationAndSorting dto) { bool isSortingListValid = true; if (dto.SortingList != null) { isSortingListValid = SortingListValidator <DtoClient> .Validate(dto.SortingList); } if (isSortingListValid) { return(new OkObjectResult(_useCasePagSort .PaginateSorting(dto.PageNumber, dto.TotalPageNumber, dto.SortingList) .Select(domainEntity => DtoClient.DomainEntityToDto(domainEntity)))); } return(new BadRequestResult()); }
public IActionResult Filter([FromBody] DtoFilter dtoFilter) { List <string> list = new List <string>(); if (dtoFilter.FilterList != null) { list = dtoFilter.FilterList.Where(data => (data.Contains("=") && FilterListValidator <DtoClient> .Validate(data))).ToList(); } if (list.Count > 0) { return(new OkObjectResult(_useCaseFilter.Filter(list) .Select(domainEntity => DtoClient.DomainEntityToDto(domainEntity)))); } return(new BadRequestResult()); }
public IActionResult Filter([FromBody] DtoFilterPaginationSorting dto) { bool isValid = false; if (dto.SortingList != null && dto.FilterList != null) { isValid = dto.FilterList.All(data => data.Contains("=") && FilterListValidator <DtoClient> .Validate(data) && SortingListValidator <DtoClient> .Validate(dto.SortingList)); } if (isValid) { var list = _useCaseFilterLike.FilterSorting(dto.PageNumber, dto.TotalPageNumber, dto.FilterList, dto.SortingList); return(new OkObjectResult(list.Select(domainEntity => DtoClient.DomainEntityToDto(domainEntity)))); } return(new BadRequestResult()); }
public IEnumerable <DtoClient> Paginate([FromBody] DtoPagination dto) { var list = _useCasePag.Paginate(dto.PageNumber, dto.TotalPageNumber); return(list.Select(domainEntity => DtoClient.DomainEntityToDto(domainEntity))); }
public IEnumerable <DtoClient> GetAll() { return(_useCaseClient.Read().Select(domainEntity => DtoClient.DomainEntityToDto(domainEntity))); }