public IActionResult EditRibbonButton(Guid id) { EditRibbonButtonModel model = new EditRibbonButtonModel(); if (!id.Equals(Guid.Empty)) { var entity = _ribbonButtonFinder.FindById(id); if (entity != null) { entity.CopyTo(model); model.WebResourceName = entity.JsLibrary; if (entity.JsLibrary.IsNotEmpty() && entity.JsLibrary.StartsWith("$webresource:")) { var wr = _webResourceFinder.FindById(Guid.Parse(entity.JsLibrary.Replace("$webresource:", ""))); if (wr != null) { model.WebResourceName = wr.Name; } else { model.JsLibrary = string.Empty; model.JsAction = string.Empty; } } return(View(model)); } } return(NotFound()); }
public IActionResult Get(Guid entityid) { EditRibbonButtonModel model = new EditRibbonButtonModel { SolutionId = SolutionId.Value, EntityId = entityid, StateCode = Core.RecordState.Enabled }; return(JOk(model)); }
public IActionResult CreateRibbonButton(Guid entityid) { EditRibbonButtonModel model = new EditRibbonButtonModel { SolutionId = SolutionId.Value, EntityId = entityid, StateCode = Core.RecordState.Enabled, ShowLabel = true }; return(View(model)); }
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 Post(EditRibbonButtonModel model) { if (ModelState.IsValid) { var entity = new RibbonButton.Domain.RibbonButton(); model.CopyTo(entity); entity.RibbonButtonId = Guid.NewGuid(); entity.CreatedBy = CurrentUser.SystemUserId; _ribbonButtonCreater.Create(entity); return(CreateSuccess(new { id = entity.RibbonButtonId })); } return(CreateFailure(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())); }
public IActionResult CreateRibbonButton(EditRibbonButtonModel model) { if (ModelState.IsValid) { var entity = new RibbonButton.Domain.RibbonButton(); model.CopyTo(entity); entity.RibbonButtonId = Guid.NewGuid(); entity.CreatedBy = CurrentUser.SystemUserId; if (entity.ShowArea != RibbonButtonArea.Form && entity.ShowArea != RibbonButtonArea.ListRow) { entity.CommandRules = string.Empty; } _ribbonButtonCreater.Create(entity); return(CreateSuccess(new { id = entity.RibbonButtonId })); } return(CreateFailure(GetModelErrors())); }