public IHttpActionResult SaveItem(ThemeAsset asset, string storeId, string themeId) { if (!string.IsNullOrEmpty(asset.AssetUrl)) { var filePath = string.Format("{0}{1}", _pathForFiles, asset.AssetUrl); asset.ByteContent = File.ReadAllBytes(filePath); } this._themeService.SaveThemeAsset(storeId, themeId, asset.ToDomainModel()); return(this.Ok()); }
public IHttpActionResult SaveItem(ThemeAsset asset, string storeId, string themeId) { base.CheckCurrentUserHasPermissionForObjects(ContentPredefinedPermissions.Update, new ContentScopeObject { StoreId = storeId }); if (!string.IsNullOrEmpty(asset.AssetUrl)) { using (var webClient = new WebClient()) { asset.ByteContent = webClient.DownloadData(asset.AssetUrl); } } this._themeService.SaveThemeAsset(storeId, themeId, asset.ToDomainModel()); return(this.Ok()); }