这是我的CheckingAccountController中的函数
public ActionResult List()
{
var AccountList = db.checkingAccounts.ToList();
return View(AccountList);
}
我尝试将List()方法视图的视图设置为脚手架,但出现“无法检索用于checkingAccount的元数据”。我不太清楚是什么问题。我正在使用ASP.NET MVC 5。
namespace BankOne.Models
{
public class CheckingAccount
{
public int Id { get; set; }
[Required]
[StringLength(10)]
[Display(Name ="Account Number")]
public string AccountNumber { get; set; }
[Required]
[Display(Name ="First Name")]
public string FirstName { get; set; }
[Required]
[Display(Name = "Last Name")]
public string LastName { get; set; }
[DataType(DataType.Currency)]
public decimal Balance { get; set; }
public string ApplicationUserId { get; set; }
public virtual ApplicationUser User { get; set; }
//lazy load
public virtual ICollection<Transaction> Transactions { get; set; }
}
}