public bool searchQuery(Client ClientDTO, ClientSearchDTO clientSearchDto) { Console.WriteLine(clientSearchDto.AddressId); Console.WriteLine(clientSearchDto.CustomerId); Console.WriteLine(clientSearchDto.ClientTypeId); return((ClientDTO.ClientName.Contains(clientSearchDto.ClientName) || String.IsNullOrWhiteSpace(clientSearchDto.ClientName)) && (ClientDTO.DateCreated >= clientSearchDto.FromCreated || clientSearchDto.FromCreated.Equals(null)) && (ClientDTO.DateCreated <= clientSearchDto.ToCreated || clientSearchDto.ToCreated.Equals(null)) && (ClientDTO.DateModified >= clientSearchDto.FromModified || clientSearchDto.FromModified.Equals(null)) && (ClientDTO.DateModified <= clientSearchDto.ToModified || clientSearchDto.FromModified.Equals(null)) && (ClientDTO.AddressId == clientSearchDto.AddressId || clientSearchDto.AddressId.Equals(null)) && (ClientDTO.CustomerId == clientSearchDto.CustomerId || clientSearchDto.CustomerId.Equals(null)) && (ClientDTO.ClientTypeId == clientSearchDto.ClientTypeId || clientSearchDto.ClientTypeId.Equals(null))); }
public ICollection <ClientDto> SearchClients(ClientSearchDTO searchClient) { try { var client = _dbContext.Client.Where(x => searchQuery(x, searchClient)); Console.WriteLine(client); if (client != null) { ICollection <ClientDto> clientDto = new List <ClientDto>(); foreach (var item in client) { clientDto.Add(Mappers.ClientRepository.MapToDto(item)); } Console.WriteLine(clientDto); return(clientDto); } } catch (Exception ex) { throw new NSIException(ex.InnerException.Message, Level.Error, ErrorType.InvalidParameter, HttpStatusCode.BadRequest); } return(null); }
public ICollection <ClientDto> SearchClients(ClientSearchDTO searchCriteria) { return(_clientRepository.SearchClients(searchCriteria)); }
public ActionResult SearchClients([FromBody] ClientSearchDTO clientSearch) { return(Ok(_clientManipulation.SearchClients(clientSearch))); }