Код: Выделить всё
peter@laptop:/data/DotNet/dotnettest$ tree -d
.
├── bin
│ └── Debug
│ └── net9.0
├── Controllers
├── Models
├── obj
│ └── Debug
│ └── net9.0
│ ├── ref
│ ├── refint
│ └── staticwebassets
├── Properties
├── Views
│ └── Home
└── wwwroot
Код: Выделить всё
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllersWithViews();
var app = builder.Build();
app.MapGet("/", () => "Hello World!");
app.MapGet("/Home", () => "Hellow there");
app.Run();
Код: Выделить всё
namespace Blog.Models
{
public class Post : Model
{
public string? Title { get; set; }
public int Views { get; set; } = 0;
public string? Content { get; set; }
public string? Excerpt { get; set; }
public string? CoverImagePath { get; set; }
public bool Public { get; set; }
}
}
< /code>
и мой контроллер: < /p>
public class Post
{
public string ActionIndex()
{
// return "This is my default action...";
return View("/Home/Index");
}
}
Код: Выделить всё
[b]testy westy[/b]
< /code>
Вот ошибка сборки. />/data/dotnet/dotnettest/controllers/postcontroller.cs(6,16): Ошибка CS0103: Имя «Просмотр» не существует в текущем контексте
buil View () Подробнее здесь: https://stackoverflow.com/questions/797 ... iew-method
Мобильная версия