priya Avanigadda

priya Avanigadda

  • NA
  • 45
  • 8.2k

How to call the model class in Jquery method??

Jul 27 2018 12:44 AM
I wrote the code in .cshtml to display the My cases label based on role
 
@using Tbg.Taxback.Crm.Models
@using Tbg.Taxback.Crm.Web.Infrastructure.Identity
@if (User.GetUserRoleEnum() == AppUserRole.TeamLeader)
{
<a href="javascript:void(0)" id="user-cases">
<b id="user-cases-counter">My Team Cases</b> (0)
</a>
}
else
{
<a href="javascript:void(0)" id="user-cases">
<b id="user-cases-counter">My Cases</b> (0)
</a>
}
 
with using key word we can get the model classes and can check the condtion based on requirement.
 
But there is another place(sample.js) to apply the same logic for $("#worklists-header-text").text("My Cases");
 
am confussed to do this , in view we can call the model class and can write the logic but the same way how can I call the same model classes with in sample.js file to apply the same logic?
 
Can anyone help me to do this??
 
I want to write a logic like
 
if (User.GetUserRoleEnum() == AppUserRole.TeamLeader))
$("#worklists-header-text").text("My Team Cases");
else
$("#worklists-header-text").text("My Cases"); by calling the models in sample.js
 
can anyone help me do resolve this ASAP??

Answers (1)