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); }
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 }; }
public ActionResult ViewBase(DataView dv) { CheckTitle(); return Request.IsAjaxRequest() ? ViewJson(dv, ViewBag.Title) : View(dv.View, dv.Model); }