Asp.net mvc 模型元组的元组问题<;HabasPortal.Models.Profile,List<;选择列表项>&燃气轮机;

Asp.net mvc 模型元组的元组问题<;HabasPortal.Models.Profile,List<;选择列表项>&燃气轮机;,asp.net-mvc,model-view-controller,view,model,database-first,Asp.net Mvc,Model View Controller,View,Model,Database First,我首先在我的项目中使用数据库。我将保存到配置文件表,并在此页面上从部门表填写一个下拉列表。如何在profile.cshtml中的视图中同时使用profile.cs和department.cs?这是一个创建页面 这是Profile.cs public partial class Profile { public int ProfileID { get; set; } public string Firstname { get; set; } public string Su

我首先在我的项目中使用数据库。我将保存到配置文件表,并在此页面上从部门表填写一个下拉列表。如何在
profile.cshtml
中的视图中同时使用
profile.cs
department.cs
?这是一个创建页面

这是
Profile.cs

public partial class Profile
{
    public int ProfileID { get; set; }
    public string Firstname { get; set; }
    public string Surname { get; set; }
    public string Department { get; set; }
    public string Office { get; set; }
    public string Location { get; set; }
    public string Username { get; set; }
    public string Email { get; set; }
    public string MobileNumber { get; set; }
    public string Title { get; set; }
    public bool Status { get; set; }
    public string Note { get; set; }
    public byte[] Image { get; set; }
    public string Gender { get; set; }
    public Nullable<System.DateTime> RecordDate { get; set; }

}
public partial class Department
{
    public int DepartmentID { get; set; }
    public string DepartmentName { get; set; }
    public string Location { get; set; }

}
我解决了这个问题

ProfileController.cs

 public ActionResult Create()
    {
        ViewBag.departman = new SelectList(db.Departments.ToList(), "DepartmentID", "DepartmentName");
        return View();
    }
Create.cshtml

@Html.DropDownList("Department", ViewBag.departman as SelectList)

有人可以回答吗?那么,元组有什么问题呢?我尝试了很多方法,但都出错了。如何使用Database First方法引用视图中的两个不同类?我想从Dropdownlist中的Department类中提取数据,并选择此传入数据并将其传输到Profile类。