Skip to content

Commit

Permalink
Fixed created at issue
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalii-bezuhlyi committed Nov 18, 2024
1 parent bc076cd commit b831dc2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 6 additions & 2 deletions Apps.Magento/Actions/BlockActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,18 @@ public async Task<BlockResponse> 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<BlockResponse>(request);
var blockResponse = await Client.ExecuteWithErrorHandling<BlockResponse>(request);

return await GetBlockAsync(new BlockIdentifier
{
BlockId = blockResponse.Id
});
}

[Action("Update block", Description = "Update block with specified data")]
Expand Down
1 change: 0 additions & 1 deletion Apps.Magento/Actions/PageActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public async Task<PageResponse> 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
}
Expand Down
6 changes: 2 additions & 4 deletions Apps.Magento/Actions/ProductActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ public async Task<FileReference> GetProductBySkuAsHtmlAsync(
}

[Action("Create product", Description = "Create product with specified data")]
public async Task<ProductResponse> CreateProductAsync(
[ActionParameter] StoreViewOptionalIdentifier storeViewIdentifier,
[ActionParameter] CreateProductRequest createProductRequest)
public async Task<ProductResponse> CreateProductAsync([ActionParameter] CreateProductRequest createProductRequest)
{
var body = new
{
Expand All @@ -97,7 +95,7 @@ public async Task<ProductResponse> 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<ProductResponse>(request);
}
Expand Down

0 comments on commit b831dc2

Please sign in to comment.