title: New ASP.net core project with scaffolded edit controller just return 404 page not found
body: <p>Just trying a new asp.net core project, based on the asp.net core web application template with individual user accounts. 
  The code below is for list definitions, and viewing and creating works fine, however - when I try to save the edits, there is just a blank page coming up. In the console I find no error messages: Only 404 Page Not Found. </p>
  
  <p>The model</p>
  
  <pre><code>public class Listdefinition
      {
          [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
          [Key]
          [ScaffoldColumn(false)]
          public Guid Id { get; set; }
          public Guid UserGuid { get; set; }
  
          public string Name { get; set; }
          public virtual ICollection&lt;Listitem&gt; ListItems { get; set; }
      }
  </code></pre>
  
  <p>The view</p>
  
  <pre><code>&lt;form asp-action="Edit"&gt;
      &lt;div class="form-horizontal"&gt;
          &lt;h4&gt;Listdefinition&lt;/h4&gt;
          &lt;hr /&gt;
          &lt;div asp-validation-summary="ModelOnly" class="text-danger"&gt;&lt;/div&gt;
      &lt;input type="hidden" asp-for="Id" /&gt;
          &lt;div class="form-group"&gt;
              &lt;label asp-for="Name" class="col-md-2 control-label"&gt;&lt;/label&gt;
              &lt;div class="col-md-10"&gt;
                  &lt;input asp-for="Name" class="form-control" /&gt;
                  &lt;span asp-validation-for="Name" class="text-danger" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label asp-for="UserGuid" class="col-md-2 control-label"&gt;&lt;/label&gt;
              &lt;div class="col-md-10"&gt;
                  &lt;input asp-for="UserGuid" class="form-control" /&gt;
                  &lt;span asp-validation-for="UserGuid" class="text-danger" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;div class="col-md-offset-2 col-md-10"&gt;
                  &lt;input type="submit" value="Save" class="btn btn-default" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The controller</p>
  
  <pre><code>namespace losol.ListR.Controllers
  {
      public class ListdefinitionsController : Controller
      {
          private readonly ApplicationDbContext _context;
  
          public ListdefinitionsController(ApplicationDbContext context)
          {
              _context = context;    
          }
   // Some code emitted for brevity
  
   // GET: ListDefinitions/Edit/5
    public async Task&lt;IActionResult&gt; Edit(Guid? id)
          {
              if (id == null)
              {
                  return NotFound();
              }
  
              var listDefinition = await _context.ListDefinition.SingleOrDefaultAsync(m =&gt; m.Id == id);
              if (listDefinition == null)
              {
                  return NotFound();
              }
              return View(listDefinition);
          }
  [HttpPost]
          [ValidateAntiForgeryToken]
          public async Task&lt;IActionResult&gt; Edit(Guid id, [Bind("Name,UserGuid")] Listdefinition listdefinition)
          {
              if (id != listdefinition.Id)
              {
                  return NotFound();
              }
  
              if (ModelState.IsValid)
              {
                  try
                  {
                      _context.Update(listdefinition);
                      await _context.SaveChangesAsync();
                  }
                  catch (DbUpdateConcurrencyException)
                  {
                      if (!ListdefinitionExists(listdefinition.Id))
                      {
                          return NotFound();
                      }
                      else
                      {
                          throw;
                      }
                  }
                  return RedirectToAction("Index");
              }
              return View(listdefinition);
          }
  </code></pre>
  
  <p>And the route:</p>
  
  <pre><code>   app.UseMvc(routes =&gt;
      {
          routes.MapRoute(
              name: "default",
              template: "{controller=Home}/{action=Index}/{id?}");
      });
  </code></pre>
  
  <p>EDIT: Just found this error message: </p>
  
  <blockquote>
    <p>Executing action method losol.ListR.Controllers.ListDefinitionsController.Edit (losol.ListR)
    with arguments (f7ddb55a-398c-4212-b686-49c88550a26f,
    losol.ListR.Models.ListDefinition) - ModelState is Valid info:
    Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommandBuilderFactory[1]
          Executed DbCommand (0ms) [Parameters=[@p2='?', @p0='?' (Size = 4000), @p1='?'], CommandType='Text', CommandTimeout='30']
          SET NOCOUNT ON;
          UPDATE [ListDefinition] SET [Name] = @p0, [UserGuid] = @p1
          WHERE [Id] = @p2;
          SELECT @@ROWCOUNT; fail: Microsoft.EntityFrameworkCore.DbContext[1]
          An exception occurred in the database while saving changes.
          Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0
    row(s). Data may have been modified or deleted since entities were
    loaded. See <a href="http://go.microsoft.com/fwlink/?LinkId=527962" rel="nofollow">http://go.microsoft.com/fwlink/?LinkId=527962</a> for
    information on understanding and handling optimistic concurrency
    exceptions.</p>
  </blockquote>