title: How to display database values in .cshtml corresponding to values in .cshtml.cs (razor pages)
body: <p>Here's what I'm trying to achieve:</p>
  <p>I am making a password generator which will generate passphrases from the <a href="https://www.eff.org/files/2016/07/18/eff_large_wordlist.txt" rel="nofollow noreferrer">diceware wordlist</a> and am using Razor pages</p>
  <p>So I have a database with the diceware list, this list goes from 11111 to 66666, you can read more about diceware and how to use it <a href="https://diceware.dmuth.org/" rel="nofollow noreferrer">here</a>.</p>
  <p><a href="https://i.stack.imgur.com/txOZ6.png" rel="nofollow noreferrer">image to the wordlist in db</a></p>
  <p>Depending on the number of words the user requires (eg. 5 word passphrase), I'll generate that many (eg. 5) 5-digit numbers and store it in an array, I perform this in the cshtml.cs page using c#</p>
  <p>My model page:</p>
  <pre class="lang-cs prettyprint-override"><code>//testdiceware.cs
  public class testdiceware
  {
      [Key]
      public int id { get; set; } 
      public string word { get; set; }
  }
  </code></pre>
  <p>The ApplicationDbContext:</p>
  <pre class="lang-cs prettyprint-override"><code>//ApplicationDbContext.cs
  public class ApplicationDbContext:DbContext
  {
      public ApplicationDbContext(DbContextOptions&lt;ApplicationDbContext&gt; options): base(options)
      {
  
      }
      public DbSet&lt;testdiceware&gt; testdiceware { get; set; }
  }
  </code></pre>
  <pre class="lang-cs prettyprint-override"><code>//PassphraseGen.cshtml.cs
  
  //dbcontext
  private readonly ApplicationDbContext _db;
  public PassphraseGenModel(ApplicationDbContext db)
  {
      _db = db;
  }
  public IEnumerable&lt;testdiceware&gt; passphrase { get; set; }
  
  //this is to generate the 5-digit numbers
  public static int[] genWord(int num)
  {
      int[] dicerolls = new int[num];
      for (int i = 0; i &lt; num; i++)
      {
          var bytes = new byte[num * 8];
          RandomNumberGenerator.Create().GetBytes(bytes);
          UInt32 value = BitConverter.ToUInt32(bytes, 0);
          int min = 11111;
          int max = 66666;
          dicerolls[i] = (int)Math.Round(min + (max - min) * (value / (uint.MaxValue + 1.0)), 0, MidpointRounding.AwayFromZero);
  
      }
      return dicerolls;
  }
  </code></pre>
  <p>The problem I'm facing:</p>
  <p>I now need to display the words corresponding to the 5-digit numbers I generated in the page-behind (.cshtml.cs) in the .cshtml (view) page, how do I go about it?</p>
  <p>P.S.</p>
  <ol>
  <li>This is a college project of mine, I won't actually be using this, so no need to mention that &quot;I shouldn't be generating passwords myself&quot;</li>
  <li>The &quot;id&quot; is not continuous, like after 11116 there's 11121, I will have to solve that but right now I need a way to print the corresponding word to the .cshtml page</li>
  </ol>