I have controller : RecruitmentController.cs and i have method/action : cekrecomended
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) &&
(c.Jurusan.Contains(jurusan) || c.Jurusan.Contains("Semua jurusan")) &&
c.Nilai <= nilai &&
c.UsiaDari <= usia &&
c.UsiaSampai >= usia &&
c.JenisKelamin.Contains(kelamin) &&
c.TglAkhirlamaran >= DateTime.Now &&
c.Dlt == false &&
c.IDVancancy == Convert.ToInt16(id)
orderby c.IDVancancy descending
select c).Count();
if (data > 0)
{
ada = "true";
}
return ada;
}
i want to access cekrecomended from view.
@if(Human_Resource_Development.Controllers.RecruitmentController.cekrecomended(Convert.ToString(item.IDVancancy)) == "true")
{
<button>Apply this position</button>
}
but i get error.