title: How to access class method from view in asp.net mvc c#?
body: <p>I have controller : RecruitmentController.cs
  and i have method/action : cekrecomended</p>
  
  <pre><code>    public string cekrecomended(string id)
      {
          id = EncryptDecrypt.Decrypt(id);
          string ada = "false";
          string jurusan = Session["Jurusan"].ToString();
          string pendidikan = Session["Pendidikan"].ToString();
          int usia = Convert.ToInt16(Session["Usia"]);
          string kelamin = Session["Kelamin"].ToString();
          double nilai = Convert.ToDouble(Session["Nilai"]);
          var data = (from c in db.ViewVacancyJabatanPerusahaans
                      where
                          c.Pendidikan.Contains(pendidikan) &amp;&amp;
                          (c.Jurusan.Contains(jurusan) || c.Jurusan.Contains("Semua jurusan")) &amp;&amp;
                          c.Nilai &lt;= nilai &amp;&amp;
                          c.UsiaDari &lt;= usia &amp;&amp;
                          c.UsiaSampai &gt;= usia &amp;&amp;
                          c.JenisKelamin.Contains(kelamin) &amp;&amp;
                          c.TglAkhirlamaran &gt;= DateTime.Now &amp;&amp;
                          c.Dlt == false &amp;&amp;
                          c.IDVancancy == Convert.ToInt16(id)
                      orderby c.IDVancancy descending
                      select c).Count();
          if (data &gt; 0)
          {
              ada = "true";
          }
          return ada;
      }
  </code></pre>
  
  <p>i want to access cekrecomended from view. </p>
  
  <pre><code>@if(Human_Resource_Development.Controllers.RecruitmentController.cekrecomended(Convert.ToString(item.IDVancancy)) == "true")
  {
      &lt;button&gt;Apply this position&lt;/button&gt;
  }
  </code></pre>
  
  <p>but i get error.</p>