我正在使用ASP .NET MVC4结构。我想在我的视图中显示不同类别的邮件列表,例如收件箱,发件箱和垃圾邮件等。如何将多个模态数据传递给将显示各个类别的数据的单个视图。例如,我想显示垃圾邮件收件箱消息并发送消息,那么我怎样才能将所有数据与各自的类别传递给视图。想要将多个模型传递给视图ASP .NET MVC4
在这里我有消息类,我想用来传递数据来查看。
public class Messages
{
public int message_Id { get; set; }
public string message_subject { get; set; }
public string message_description { get; set; }
public System.DateTime message_date { get; set; }
public int sender { get; set; }
public int project_id { get; set; }
public string message_size { get; set; }
public string file_id { get; set; }
public int reciever { get; set; }
public int star { get; set; }
public int read { get; set; }
public string sender_name { get; set; }
public string reciever_name { get; set; }
public string type { get; set; }
public int isActive { get; set; }
}
请如果有任何错误解释我的问题,请编辑它。英文不好。由于
使用部分视图 –
1.将一个属性添加到MessageStatus中以表示收件箱,发件箱等。2.使用ViewModel,这是一个额外的抽象,位于核心模型之上用于演示目的。当用户将数据发布到服务器时,数据将通过模型联编程序绑定到视图模型。然后在动作中,您可以将视图模型映射到核心模型并对其进行处理。 – Larry