title: Operator '>' cannot be applied to operands of type 'string' and 'int' using Asp.net Mvc
body: <p>i am creating a simple crud system using asp.net mvc.  when i enter the record and click add button this error displayed.  </p>
  
  <p>I get the error on this line:  <code>if (rec.id &gt; 0)</code> </p>
  
  <blockquote>
    <p>(parameter)product rec</p>
    
    <p>operator '>' cannot be applied to operands of type 'string' and 'int'**</p>
  </blockquote>
  
  <p>Code which i tried </p>
  
  <p><strong>sales controller</strong></p>
  
  <pre><code> public ActionResult save(product rec)
      {
          bool status = false;
          if (ModelState.IsValid)
          {
              using (aspposEntities1 db = new aspposEntities1())
              {
                  if (rec.id &gt; 0) // this line i got the error
                  {
                      var v = db.products.Where(a =&gt; a.id == rec.id).FirstOrDefault();
                      if (v != null)
                      {
                          v.proname = rec.proname;
                          v.cat_id = rec.cat_id;
                          v.brand_id = rec.brand_id;
                          v.qty = rec.qty;
                          v.price = rec.price;
                          db.Entry(v).State = EntityState.Modified;
                      }
                  }
                  else
                  {
                      db.products.Add(rec);
                  }
  
                  db.SaveChanges();
                  status = true;
              }
          }
          return new JsonResult { Data = new { status = status } };
      }
  </code></pre>
  
  <p><strong>product class</strong>
  <strong>product.cs</strong></p>
  
  <pre><code>public partial class product
  {
      public string id { get; set; }
      public string proname { get; set; }
      public Nullable&lt;int&gt; cat_id { get; set; }
      public Nullable&lt;int&gt; brand_id { get; set; }
      public Nullable&lt;int&gt; qty { get; set; }
      public Nullable&lt;int&gt; price { get; set; }
  }
  </code></pre>