public bool Import(Guid solutionId, List <RibbonButtonXmlInfo> ribbonButtons) { if (ribbonButtons.NotEmpty()) { foreach (var item in ribbonButtons) { var entity = _ribbonButtonFinder.FindById(item.RibbonButtonId); if (entity != null) { entity.CssClass = item.CssClass; entity.DisplayOrder = item.DisplayOrder; entity.Icon = item.Icon; entity.JsAction = item.JsAction; entity.JsLibrary = item.JsLibrary; entity.Label = item.Label; entity.ShowArea = item.ShowArea; entity.StateCode = item.StateCode; _ribbonButtonUpdater.Update(entity); } else { item.SolutionId = solutionId; item.ComponentState = 0; item.CreatedBy = _appContext.GetFeature <ICurrentUser>().SystemUserId; item.CreatedOn = DateTime.Now; _ribbonButtonCreater.Create(item); } } } return(true); }
public IActionResult Post(EditRibbonButtonModel model) { if (ModelState.IsValid) { var entity = _ribbonButtonFinder.FindById(model.RibbonButtonId.Value); model.CopyTo(entity); _ribbonButtonUpdater.Update(entity); return(UpdateSuccess(new { id = entity.RibbonButtonId })); } return(UpdateFailure(GetModelErrors())); }
public IActionResult EditRibbonButton(EditRibbonButtonModel model) { if (ModelState.IsValid) { var entity = _ribbonButtonFinder.FindById(model.RibbonButtonId.Value); model.CopyTo(entity); if (entity.ShowArea != RibbonButtonArea.Form && entity.ShowArea != RibbonButtonArea.ListRow) { entity.CommandRules = string.Empty; } _ribbonButtonUpdater.Update(entity); return(UpdateSuccess(new { id = entity.RibbonButtonId })); } return(UpdateFailure(GetModelErrors())); }