/// <summary> /// call customer Search repository object /// </summary> /// <param name="customerSearchParams"></param> /// <returns></returns> public ServiceResponse GetCustomersByNames(CustomerSearchParams customerSearchParams) { try { var returnObject = _customerRepository.GetCustomerBynames(customerSearchParams); return(_serviceResponseMapper.Map(returnObject)); } catch { throw; } }
/// <summary> /// Get the customers /// </summary> /// <param name="customerSearchParams"></param> /// <returns></returns> public List <Customers> GetCustomerBynames(CustomerSearchParams customerSearchParams) { try { var returnObj = _customerEntities.BcTCustomers.Where((l => (l.FirstName.Contains(customerSearchParams.FirstName) || customerSearchParams.FirstName == null || customerSearchParams.FirstName == "") && (l.LastName.Contains(customerSearchParams.LastName) || customerSearchParams.LastName == null || customerSearchParams.LastName == "") && (l.Id == customerSearchParams.Id || customerSearchParams.Id == null || customerSearchParams.Id == 0))).ToList(); return(_entityMapper.Map <List <BcTCustomer>, List <Customers> >(returnObj)); } catch (Exception ex) { //_logger.LogError<ImsUser>(ex.ToString()); throw; } }
public IQueryable <Customer> Get(CustomerSearchParams parameters) { IQueryable <Customer> results = list.AsQueryable(); if (parameters.From.HasValue) { results = results.Where(x => x.Birth >= parameters.From); } if (parameters.To.HasValue) { results = results.Where(x => x.Birth <= parameters.To); } return(results); }