using System;using System.Web.Mvc;namespace Razor.Controllers{public class HomeController : Controller{Razor.Models.Product myProduct = new Models.Product { ProductID = 1, Name = \"Book\"};Razor.Models.Person myPerson = new Models.Person { PersonID = \"1\", Name = \"Jack\" };public ActionResult Index(){return View(Tuple.Create(myProduct,myPerson)); // 返回一个Tuple对象,Item1代表Product、Item2代表Person}}}
前端页面
@model Tuple<Razor.Models.Product, Razor.Models.Person>@{Layout = null;}<!DOCTYPE html><html><head><meta name=\"viewport\" content=\"width=device-width\" /><title>Index</title></head><body><div>@Model.Item1.Name</div></body></html>