Go to the documentation of this file.00001 using System;
00002 using System.Collections.Generic;
00003 using System.Linq;
00004 using System.Text;
00005 using System.Web.Mvc;
00006
00007 namespace N2.Web.Mvc
00008 {
00009 public static class ControllerExtensions
00010 {
00011 public static ViewResult View(this Controller controller, object model, ContentItem item)
00012 {
00013 return controller.View(null, model, item);
00014 }
00015 public static ViewResult View(this Controller controller, string viewName, object model, ContentItem item)
00016 {
00017 if (model != null)
00018 {
00019 controller.ViewData.Model = model;
00020 }
00021 controller.ViewData[ContentRoute.ContentItemKey] = item;
00022
00023 ViewResult result = new ViewResult();
00024 result.ViewName = viewName;
00025 result.ViewData = controller.ViewData;
00026 result.TempData = controller.TempData;
00027 return result;
00028 }
00029 }
00030 }