From b831dc2b8973a3566c6740bfbce0cbf7e4bb7fac Mon Sep 17 00:00:00 2001 From: vitalii-bezuhlyi Date: Mon, 18 Nov 2024 11:43:21 +0200 Subject: [PATCH] Fixed created at issue --- Apps.Magento/Actions/BlockActions.cs | 8 ++++++-- Apps.Magento/Actions/PageActions.cs | 1 - Apps.Magento/Actions/ProductActions.cs | 6 ++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Apps.Magento/Actions/BlockActions.cs b/Apps.Magento/Actions/BlockActions.cs index 3713643..52a87db 100644 --- a/Apps.Magento/Actions/BlockActions.cs +++ b/Apps.Magento/Actions/BlockActions.cs @@ -54,14 +54,18 @@ public async Task CreateBlockAsync([ActionParameter] CreateBlockR identifier = createBlockRequest.Identifier, title = createBlockRequest.Title, content = createBlockRequest.Content, - creation_time = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture), active = true } }; var request = new ApiRequest("/rest/V1/cmsBlock", Method.Post, Creds) .AddBody(body); - return await Client.ExecuteWithErrorHandling(request); + var blockResponse = await Client.ExecuteWithErrorHandling(request); + + return await GetBlockAsync(new BlockIdentifier + { + BlockId = blockResponse.Id + }); } [Action("Update block", Description = "Update block with specified data")] diff --git a/Apps.Magento/Actions/PageActions.cs b/Apps.Magento/Actions/PageActions.cs index 15d1e25..c9ecac9 100644 --- a/Apps.Magento/Actions/PageActions.cs +++ b/Apps.Magento/Actions/PageActions.cs @@ -60,7 +60,6 @@ public async Task CreatePageAsync([ActionParameter] CreatePageRequ meta_description = pageRequest.MetaDescription, content_heading = pageRequest.ContentHeading, content = pageRequest.Content, - creation_time = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture), sort_order = pageRequest.SortOrder, active = true } diff --git a/Apps.Magento/Actions/ProductActions.cs b/Apps.Magento/Actions/ProductActions.cs index 02ac97e..ac58806 100644 --- a/Apps.Magento/Actions/ProductActions.cs +++ b/Apps.Magento/Actions/ProductActions.cs @@ -73,9 +73,7 @@ public async Task GetProductBySkuAsHtmlAsync( } [Action("Create product", Description = "Create product with specified data")] - public async Task CreateProductAsync( - [ActionParameter] StoreViewOptionalIdentifier storeViewIdentifier, - [ActionParameter] CreateProductRequest createProductRequest) + public async Task CreateProductAsync([ActionParameter] CreateProductRequest createProductRequest) { var body = new { @@ -97,7 +95,7 @@ public async Task CreateProductAsync( } }; - var request = new ApiRequest($"/rest/{storeViewIdentifier}/V1/products", Method.Post, Creds) + var request = new ApiRequest("/rest/V1/products", Method.Post, Creds) .AddBody(body); return await Client.ExecuteWithErrorHandling(request); }