The first line of code in a View should give the type for the model like so:
@model Tuple<Guid, Guid>
Once you have a model, you may then fish for things inside of it with the usual dot syntax like so:
@Model.Item1 and @Model.Item2
Outside of the view, my Controller looks like this:
using System;
using System.Web.Mvc;
namespace GuidExperiment.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
Guid foo = Guid.NewGuid();
Guid bar = new Guid();
Tuple<Guid,Guid> guidModel = new Tuple<Guid, Guid>(foo, bar);
return View(guidModel);
}
}
}
No comments:
Post a Comment