I have renderad a CRUD with .net and have the following files in the same folder.
Create.cshtml, Delete.cshtml, Details.cshtml, Edit.cshtml, Index.cshtml
Now it is a link to create a new record on the index page
@Html.ActionLink("Create New", "Create")
But I want the create form to be on the index page.
I tested to use PartialView (I do not know whether it is better to copy the code from create.cshtml in index.cshtml or to use two files but I get the same error).
Changed the return
in the controller to return PartialView(board);
And the view to @Html.Partial("Create")
But I get the compiling error
The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[Klotterplank.Models.Board]', but this dictionary requires a model item of type 'Klotterplank.Models.Board'.
This is the model I use in index.cshtml
@model IEnumerable<Klotterplank.Models.Board>
And this is the model I use in create.cshtml
@model Klotterplank.Models.Board