示例#1
0
 protected ActionResult ViewBase(string selector, string viewName, object model)
 {
     if (string.IsNullOrEmpty(selector)) {
         throw new Exception("Необходим селектор");
     }
     if (string.IsNullOrEmpty(viewName)) {
         viewName = ControllerContext.RouteData.GetRequiredString("action");
     }
     DataView dv = new DataView { View = viewName, Model = model, Selector = selector };
     return ViewBase(dv);
 }
示例#2
0
 protected ActionResult ViewJson(DataView dv, string pageTitle)
 {
     JsonData dat = new JsonData { Title = pageTitle };
     dat.Repl.Add(new Replacer { Select = dv.Selector, Data = RenderView(dv.View, dv.Model) });
     return new JsonResult {
         Data = dat,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
示例#3
0
 public ActionResult ViewBase(DataView dv)
 {
     CheckTitle();
     return Request.IsAjaxRequest() ? ViewJson(dv, ViewBag.Title) : View(dv.View, dv.Model);
 }