Reputation: 23
After installing .NET Core 3.1 none of Razor's commands work. As you can see in the picture, all Razor commands are red enter code here
.
@model
@{
ViewData["Title"] = "LessonCreate";
Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
Upvotes: 1
Views: 6301
Reputation: 45
namespace MyProject.Models;
public class Lesson
{
...
}
@model IEnumerable<MyProject.Models.Lesson>
Upvotes: 1
Reputation: 191
I had the same error and I had written this
@model List<MyModel>()
The solution was to simply remove the brackets
@model List<MyModel>
Upvotes: 3
Reputation: 9502
According to the documentation, the @model
attribute expects a type name of the model. The syntax is:
@model TypeNameOfModel
You just need to provide the model type to the @model
attribute, or remove the line, if the Razor view does not use a model.
Razor syntax reference for ASP.NET Core:
Upvotes: 2