title: Handlebars inside MVC Razor view
body: <p>I'm using handlebars inside a razor view in an ASP.NET MVC application.</p>
  
  <p>I have a situation where I have to use handlebar's if condition inside a razor's else condition something like below.</p>
  
  <p><strong>Index.cshtml</strong></p>
  
  <pre><code>&lt;script id="template" type="text/x-handlebars-template"&gt;
         ....
        @if (CurrentUserRepository.IsInRoleEnums(RoleEnum.TPS_Administrator)) 
             {
                 &lt;i class="fas fa-trash-alt text-dark pointer" title="Delete this item" onclick="DeleteNotification({{NotificationId}})"&gt;&lt;/i&gt;
             }
         else
             {
                //handlebars shown below doesn't work
                {{#if UserCanSetClosed}}
                   &lt;i class="fas fa-trash-alt text-dark pointer" title="Delete this item" onclick="DeleteNotification({{NotificationId}})"&gt;&lt;/i&gt;
                {{/if}}                    
             }
  &lt;/script&gt;
  </code></pre>
  
  <p>I know one alternative is to get all the values needed for conditions inside the json passed to handlebars and use it with handlebars conditions in the template. But I want to make use of Razor where ever possible.</p>
  
  <p>Is there any way to get this done? </p>
  
  <p>Note: I tried searching in the repository but this question doesn't seem to be a duplicate one!</p>