title: ASP.NET MVC - Get database data depending user role
body: <p>I'm fairly new to the MVC and database stuff.</p>
  
  <p>What I need to do is retrieve data depending on a user's role. I can get all the data from the table below but I need to only show specific data.</p>
  
  <pre>
  <b>tableId      roleId        data1        data2        data3</b>
    1            1         some data    some data    some data
    2            1         some data    some data    some data 
    3            1         some data    some data    some data
    4            2         some data    some data    some data 
    5            2         some data    some data    some data
    6            3         some data    some data    some data 
  </pre>
  
  <p>So if a user is logged in and assigned a role, how would I fetch data from the table for that role?
  If I am assigned roleId 1, I should only see data from the table with roleId = 1.</p>
  
  <p>I'm still learning and this would be awesome help.</p>
  
  <p>THANKS!</p>
  
  
  
  <p>My Code:</p>
  
  <p>Controller</p>
  
  <pre><code>    private projectEntities db = new projectEntities();
  
      // GET: /Assessment/
      public ActionResult Index()
      {
          //return View(db.Scales.ToList());
          var data = new ModelServices().GetScale();
          return View(data);
  
  
      }
  </code></pre>
  
  <p>Model</p>
  
  <pre><code>public class ModelServices : IDisposable
  {
      private readonly projectEntities entities = new projectEntities();
      public IEnumerable GetScale()
      {
          return entities.Scales.ToList();
      }
      public void Dispose()
      {
          entities.Dispose();
      }
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>@model IEnumerable&lt;project.Models.Scale&gt;
  @{
  WebGrid grid = new WebGrid(Model);   
  }
  
  @grid.GetHtml()
  </code></pre>