title: Linq check value in SQL table always is false
body: <p>I tried to check if the cost or benefit value exists for the selected Id, then I will get the cost or benefit value from the table.
  In the code below my if statement doesn't work and seems to always be false but the return benefit value works fine. Where is the problem?</p>
  <pre><code>    public string GetCostBenefitAmount(int id)
      {
          if (db.CostBenefits.Any(c =&gt; c.ID == id &amp;&amp; !c.Cost.Equals(0)))
          {
              return db.CostBenefits.Select(c =&gt; c.Cost).First().ToString();
          }
          return db.CostBenefits.Where(c=&gt; c.ID == id).Select(c =&gt; c.Benefit).First().ToString();
      }
  </code></pre>
  <p>This is my code in windows form for fill txtAmount textBox by GetCostBenefitAmount(int id) method:</p>
  <pre><code>            var stockIdList = db.CostBenefitRepository.GetAllID();                
              int id = stockIdList[listBox.SelectedIndex];
              CostBenefit costBenefit = db.GenericCostBenefitRepository.GetById(id);
              txtStockName.Text = listBox.SelectedItem.ToString();
              txtSoldAmount.Text = costBenefit.SoldAmount.ToString();
              ComboCostBenefit.SelectedItem = db.CostBenefitRepository.GetCostBenefitOperation(id);
              txtAmount.Text = db.CostBenefitRepository.GetCostBenefitAmount(id);
  </code></pre>