我正在尝试设置一个简单的页面来显示项目列表,但我遇到了所有类型的奇怪错误。我怀疑它们是我设置中缺少的简单内容。任何想法,对此表示赞赏。我不是
列出的第一个错误是: 严重性代码说明项目文件行抑制状态 错误CS0115'_Page_Pages_Admin_Setup_Lots_Index_cshtml.Execute()':找不到合适的方法来覆盖管理C:\ Users \ theev \ Dropbox \ Projects \ RealEstate \ Management \ Management \ Pages \ Admin \ Setup \ Lots \ Index.cshtml 1活动
cs文件:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Management.Libraries;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Management.Pages.Admin.Setup.Lots
{
public class IndexModel : PageModel
{
public IndexModel()
{
Subdivisions = new List<Subdivision>();
}
[BindProperty]
List<Subdivision> Subdivisions { get; set; }
public async Task OnGetAsync()
{
var da = new DataAccess();
var subs = await da.SubdivisionsAsync();
Subdivisions = subs;
}
}
}
cshtml页面:
@page
@model Management.Pages.Admin.Setup.Lots.IndexModel
@{
ViewData["Title"] = "Index";
Layout = "~/Layouts/_DesktopTemplate.cshtml";
}
<h2>Index</h2>
<table>
<tr>
<th>Name</th>
<th>Location</th>
<th>Edit</th>
<th>Delete</th>
</tr>
@{
foreach(var s in Model.Subdivisions)
{
<tr>
<td>@s.Name</td>
</tr>
}
}
</table>
我只是不确定是否缺少明显的东西。