Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8499911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:47:46+00:00 2026-06-11T00:47:46+00:00

Afternoon, I am passing in a bool value from a text box, and i

  • 0

Afternoon,
I am passing in a bool value from a text box, and i need to check to see if its true or false then add the correct codetype (int) for it to search by.

for example

if (hasASIN == true)
{
    int show = 5;
}
else {
    int show = 1, 2, 3, 4 (these are the other code types)
}

i then would need to add a where clause to my LINQ statement.

where a.codeType == show (need to have this maybe in a || (or) bit so i can use the other code types)

below is my existing LINQ Code

 var query = from a in dc.aboProducts
             join t in dc.tweProducts on a.sku equals t.sku

             where (string.IsNullOrEmpty(productSku) || productSku == t.sku)
             where (string.IsNullOrEmpty(productAsin) || productAsin == a.asin)
             where (string.IsNullOrEmpty(productName) || t.title.Contains(productName))
             where (string.IsNullOrEmpty(productBrand) || t.brand.Contains(productBrand))
             where a.amzPrice >= priceFrom && a.amzPrice <= (priceTo)
             where a.amzLive == isLive 

             select new GetProducts
             {
                productid = Convert.ToInt32(t.id),
                sku = t.sku,
                title = t.title,
                tweprice = Convert.ToString(t.twePrice),
                stock = Convert.ToInt32(t.stock),
                asin = a.asin,
                amzprice = Convert.ToString(a.amzPrice),
                amzlive = Convert.ToBoolean(a.amzLive),
                lastupdated = Convert.ToDateTime(t.lastUpdated)
             };
  return query.ToList();

I hope i have explained this ok, if not feel free to ask away 🙂 Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:47:47+00:00Added an answer on June 11, 2026 at 12:47 am

    After much search i found the answer which worked a treat…

    where (hasASIN == true && a.codeType == 5) || (a.codeType == 1 || a.codeType == 2 || a.codeType == 3 || a.codeType ==4)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Afternoon, I need to split an array into smaller "chunks". I am passing over
Afternoon all, In need of some technical advice from the masters... I know the
Afternoon, I would like to know how i can add a class depending on
Afternoon, I am setting the ID's for a multiple text boxes in my code
Afternoon All, I have a web site where i need to know who is
Afternoon all, I tried to add a second data entity to the persistent store
Afternoon all, I really need your help as this is a Nightmare! I was
Whole afternoon I am struggling with the getting data from associations. I have these
Afternoon, I would like to return a bool if the prices match. I am
Afternoon, I am trying to return a list of products from my SQL Server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.