0

Good Morning,

I have the following code:

  public ActionResult ViewCategory(int category)
    {
        var items = from indexVariable in DatabaseEntities.classifieds
                    where indexVariable.category = category
                    select indexVariable;
        return View(items.ToList());
    }

This code doesn't work, the error is on the where line. I am sure you can all see what I am trying to achieve, I want to only pull up results for the specified category.

Many Thanks.

1 Answer 1

1

Use double == for boolean expressions, the simple = is an assignment operator:

where indexVariable.category == category
Sign up to request clarification or add additional context in comments.

1 Comment

Cheers, that was a completely stupid question on reflection. But I was sat there trying to figure it out for an age.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.