【发布时间】:2021-09-17 10:16:36
【问题描述】:
我有这两个模型
public class FileType
{
public int Id { get; set; }
public string Name { get; set; }
}
public class Genre
{
public int Id { get; set; }
public string Name { get; set; }
[ForeignKey("FileType")]
public int FileTypeID { get; set; }
}
以及这些模型在 PostgreSQL 数据库中的数据表,我想在视图中创建 2 个下拉列表,名称为文件类型,名称为流派。我想在此上传视图中创建 2 个 ddl
public class FileUploadViewModel
{
public List<FileModel> Files { get; set; }
public string Name { get; set; }
public string Extension { get; set; }
public string Description { get; set; }
public string Author { get; set; }
public string Year { get; set; }
public string FilePath { get; set; }
public string PublishedOn { get; set; }
public int DownloadCounter { get; set; }
}
【问题讨论】:
-
这能回答你的问题吗? MVC DropDown from DataBase
标签: c# asp.net-mvc postgresql asp.net-core model-view-controller