public ActionResult Create(QueryContext context) { var template = new WidgetTemplateService().Get(context.WidgetTemplateID); var widget = template.CreateWidgetInstance(); widget.PageID = context.PageID; widget.LayoutID = context.LayoutID; widget.ZoneID = context.ZoneID; widget.FormView = template.FormView; widget.Position = new WidgetService().GetAllByPageId(context.PageID).Count(m => m.ZoneID == context.ZoneID) + 1; ViewBag.ReturnUrl = context.ReturnUrl; if (template.FormView.IsNotNullAndWhiteSpace()) { return View(template.FormView, widget); } return View(widget); }
public ActionResult Create(QueryContext context) { var template = new WidgetTemplateService().Get(context.WidgetTemplateID); var widget = template.CreateWidgetInstance(); widget.PageID = context.PageID; widget.LayoutID = context.LayoutID; widget.ZoneID = context.ZoneID; widget.FormView = template.FormView; widget.Position = new WidgetService().GetAllByPageId(context.PageID).Count(m => m.ZoneID == context.ZoneID) + 1; ViewBag.ReturnUrl = context.ReturnUrl; if (template.FormView.IsNotNullAndWhiteSpace()) { return(View(template.FormView, widget)); } return(View(widget)); }