public virtual ActionResult EditWidget(ICoreWidgetInstance instance) { var widgetModel = new LoginHolderWidgetEditModel(); if (instance != null) { NHibernate.Models.LoginHolderWidget widget = null; if (instance.InstanceId != null) { var existingWidget = loginHolderWidgetService.Find((long)instance.InstanceId); if (existingWidget != null) widget = existingWidget; } if (widget == null) { widget = new NHibernate.Models.LoginHolderWidget(); loginHolderWidgetService.Save(widget); IWidgetHelper widgetHelper = ServiceLocator.Current.GetInstance<IWidgetHelper>(); widgetHelper.UpdatePageWidgetInstance(instance.PageWidgetId ?? 0, widget.Id, this.CorePrincipal()); } widgetModel = widgetModel.MapFrom(widget); } return PartialView(widgetModel); }
public virtual ActionResult EditWidget(ICoreWidgetInstance instance) { var widgetModel = new LoginHolderWidgetEditModel(); if (instance != null) { NHibernate.Models.LoginHolderWidget widget = null; if (instance.InstanceId != null) { var existingWidget = loginHolderWidgetService.Find((long)instance.InstanceId); if (existingWidget != null) { widget = existingWidget; } } if (widget == null) { widget = new NHibernate.Models.LoginHolderWidget(); loginHolderWidgetService.Save(widget); IWidgetHelper widgetHelper = ServiceLocator.Current.GetInstance <IWidgetHelper>(); widgetHelper.UpdatePageWidgetInstance(instance.PageWidgetId ?? 0, widget.Id, this.CorePrincipal()); } widgetModel = widgetModel.MapFrom(widget); } return(PartialView(widgetModel)); }
public virtual ActionResult UpdateWidget(LoginHolderWidgetEditModel model) { if (ModelState.IsValid) { var widget = new NHibernate.Models.LoginHolderWidget(); if (model.Id > 0) { widget = loginHolderWidgetService.Find(model.Id); } widget = model.MapTo(widget); loginHolderWidgetService.Save(widget); model.MapFrom(widget); Success(HttpContext.Translate("Messages.Success", ResourceHelper.GetControllerScope(this))); } return(PartialView("EditWidget", model)); }
public virtual ActionResult UpdateWidget(LoginHolderWidgetEditModel model) { if (ModelState.IsValid) { var widget = new NHibernate.Models.LoginHolderWidget(); if (model.Id > 0) { widget = loginHolderWidgetService.Find(model.Id); } widget = model.MapTo(widget); loginHolderWidgetService.Save(widget); model.MapFrom(widget); Success(HttpContext.Translate("Messages.Success", ResourceHelper.GetControllerScope(this))); } return PartialView("EditWidget", model); }