I need to create an empty form for database update. In the controller this is called: public ViewResult Create() => View("Edit", new List());
<TargetFramework>netcoreapp2.2</TargetFramework>
I have a class MeetingListContext : DbContext that has 3 models:
1. DbSet List
2. DbSet ATime (Look up table to show time name instead of time id)
3. DbSet DOW (Look up table to show day name instead of day id)
Model
namespace DEIGList.Models
{
public partial class MeetingListContext : DbContext
{
public MeetingListContext()
{
}
public MeetingListContext(DbContextOptions<MeetingListContext> options)
: base(options)
{
}
public virtual DbSet<ATime> ATime { get; set; }
public virtual DbSet<Dow> Dow { get; set; }
public virtual DbSet<List> List { get; set; }
The View:
@model DEIGList.Models.MeetingListContext
In the controller:
public ViewResult Create() => View("Edit", new List());
The expected result will be a form with empty data fields for fill in data. I would like to be able to use drop downs (lookups) for the day and time.
But when I use @model DEIGList.Models.MeetingListContext I get:
InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'DEIGList.Models.List', but this ViewDataDictionary instance requires a model item of type 'DEIGList.Models.MeetingListContext'.
Suggestion?