title: C# MVC userisinrole usage
body: <p>I am a beginner and I have been taught that to use user.isinrole to check the identity of the user, some navigation bar will be hided if the user is not manager or admin. And I wonder if user.isinrole can check other things.</p>
  <p>For example in this database screenshot, A boolean data type named Active is supposed to check whether the new register account is activate by admin or not. If the answer is false, a navigation bar called Make Investment will be hided
  <a href="https://i.stack.imgur.com/9X14G.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9X14G.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/c7UQw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c7UQw.png" alt="enter image description here" /></a></p>
  <p>However my Active column is not the as user role which contains admin user and manager, it contains with boolean value. Is there any way for user.isinrole to check the boolean value?</p>
  <p>Here is the code for Company List page</p>
  <pre><code>@model List&lt;Company&gt;
  @{  
      var company = ViewData[&quot;company&quot;] as List&lt;Company&gt;;
  }
  
  @section MoreScripts {
      &lt;link href=&quot;~/lib/datatables/css/jquery.dataTables.min.css&quot; rel=&quot;stylesheet&quot; /&gt;
      &lt;script src=&quot;~/lib/datatables/js/jquery.dataTables.min.js&quot;&gt;&lt;/script&gt;
  
      @{
          // TODO: L13 Task 04 - Use JQuery DataTable to make the movie table responsive            //CompanyTable
      }
      &lt;script&gt;
          $(document).ready(function () { 
              $('#jsCompanyTable').DataTable({        
                  paging: true,
                  ordering: true,
                  searching: true,
                  info: true,
                  lengthMenu: [[6, 10, 20, -1], [6, 10, 20, &quot;ALL&quot;]]
              });
          });
      &lt;/script&gt;
      }
      &lt;h2&gt;Company List&lt;/h2&gt;
  
      @if (TempData[&quot;Message&quot;] != null)
      {
          &lt;div class=&quot;alert alert-@TempData[&quot;MsgType&quot;]&quot;&gt;
              @TempData[&quot;Message&quot;]
          &lt;/div&gt;
      }
  
        
  
  &lt;table id=&quot;jsCompanyTable&quot; class=&quot;table&quot;&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th scope=&quot;col&quot;&gt;Company ID&lt;/th&gt;
              &lt;th scope=&quot;col&quot;&gt;Company Name&lt;/th&gt;
              &lt;th scope=&quot;col&quot;&gt;Contact&lt;/th&gt;
              &lt;th scope=&quot;col&quot;&gt;Address&lt;/th&gt;
              
                  &lt;th scope=&quot;col&quot;&gt;Operation&lt;/th&gt;
              
              &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
            
         @foreach (Company user in Model)
         {
          &lt;tr&gt;
  
              &lt;td&gt;@user.C_id&lt;/td&gt;
              &lt;td&gt;@user.C_name&lt;/td&gt;
  
              &lt;td&gt;@user.C_email&lt;/td&gt;
              &lt;td&gt;@user.C_address&lt;/td&gt;
  
              
                  &lt;td&gt;
  
  
                      &lt;a asp-controller=&quot;Finance&quot;
                         asp-action=&quot;MakeInvestment&quot;
                         asp-route-id=&quot;@user.C_id&quot;&gt;
                          Make Investment
                      &lt;/a&gt;
  
                  &lt;/td&gt;
              
  
  
          &lt;/tr&gt;
          }
          
  &lt;/table&gt;
  </code></pre>
  <p>Here is the code for Controller</p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Data;
  using System.Linq;
  using System.Threading.Tasks;
  using Microsoft.AspNetCore.Authorization;
  using Microsoft.AspNetCore.Mvc;
  using Microsoft.AspNetCore.Mvc.Rendering;
  using DDemo.Models;
  
  namespace DDemo.Controllers
  {
      public class FinanceController : Controller
      {
          
  
          [AllowAnonymous]
          public IActionResult About()
          {
              return View();
          }
  
          [Authorize]
          public IActionResult ListCompanies()
          {
  
              List&lt;Company&gt; companies = DBUtl.GetList&lt;Company&gt;(&quot;SELECT * FROM Company &quot;);
              return View(companies);
  
          }
          [Authorize]
          [HttpGet]
          public IActionResult MakeInvestment()
          {
              return View();
          }
  
          
      }
  }
  </code></pre>