public IActionResult EditWebResource(Guid id) { EditWebResourceModel model = new EditWebResourceModel(); if (!id.Equals(Guid.Empty)) { var entity = _webResourceFinder.FindById(id); if (entity != null) { entity.CopyTo(model); model.Content = _webResourceContentCoder.CodeDecode(model.Content); return(View(model)); } } return(NotFound()); }
public bool Import(Guid solutionId, IList <Domain.WebResource> webResources) { if (webResources.NotEmpty()) { foreach (var item in webResources) { var entity = _webResourceFinder.FindById(item.WebResourceId, false); if (entity != null) { entity.Content = item.Content; entity.Description = item.Description; entity.Name = item.Name; _webResourceUpdater.Update(entity); } else { item.ComponentState = 0; item.SolutionId = solutionId; item.CreatedBy = _appContext.GetFeature <ICurrentUser>().SystemUserId; item.OrganizationId = _appContext.OrganizationId; _webResourceCreater.Create(item); } } } return(true); }
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 Picture(Guid id) { var entity = _webResourceFinder.FindById(id); if (entity != null && entity.WebResourceType == WebResourceType.Picture) { return(new ImageResult(_webResourceContentCoder.DecodeToByte(entity.Content), "image/jpeg")); } return(Content("")); }