title: How can I keep my model in my View after OnPost?
body: <p>I'm on a project with .Net Core and I'm using ASP Razor Pages.
  In my model, I have an OnGet which load all the data I need in my view.</p>
  
  <pre><code>public IList&lt;Projet&gt; Projets { get; set; }
  public ActionResult OnGet()
  {
      Projets = _serviceSelect.getProjets();
      return Page();
  }
  </code></pre>
  
  <p>Then, in my OnPost which is activated when I submit my form.</p>
  
  <pre><code>&lt;form method="post"&gt;
      &lt;div asp-validation-summary="All" class="text-danger"&gt;&lt;/div&gt;
      &lt;input type="radio" value="1" asp-for="LoginData.TypeCompte" /&gt;choice&lt;br /&gt;
      Username: &lt;input asp-for="LoginData.Username" /&gt;&lt;br /&gt;
      Password: &lt;input asp-for="LoginData.Password" /&gt;&lt;br /&gt;
      Remember me: &lt;input asp-for="LoginData.RememberMe" type="checkbox" /&gt;&lt;br /&gt;
      &lt;input asp-page-handler="connexion" type="submit" value="Login" /&gt;
      @Html.AntiForgeryToken()
  &lt;/form&gt;
  </code></pre>
  
  <p>I would like to display an error in my view, using my ModelState.</p>
  
  <pre><code>public ActionResult OnPostConnexion()
  {
      if (ModelState.IsValid)
      {
         // Do stuff 
      }
      else
      {
          ModelState.AddModelError("", "username or password is blank");
          return Page();
      }
  }
  </code></pre>
  
  <p>But, when I return Page(), It's like the model is reload and when I try to access to my data, my objects are null.</p>
  
  <pre><code> Object reference not set to an instance of an object.
  @foreach (var item in Model.Projets)
  </code></pre>
  
  <p>How can I update my view without losing my data contain in the model ?</p>