Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Sitecore.Commerce.Core;
using Sitecore.Commerce.Core.Commands;
using Sitecore.Services.Examples.Catalog.Pipelines;
using Sitecore.Services.Examples.Catalog.Pipelines.Arguments;
namespace Sitecore.Services.Examples.Catalog.Commands
{
public class CreateUpdateSellableItemCommand : CommerceCommand
{
private readonly ICreateUpdateSellableItemPipeline _pipeline;
public CreateUpdateSellableItemCommand(ICreateUpdateSellableItemPipeline pipeline, IServiceProvider serviceProvider) : base(serviceProvider)
{
_pipeline = pipeline;
}
public async Task<bool> Process(CommerceContext commerceContext, List<CreateUpdateSellableItemArgument> args)
{
using (var activity = CommandActivity.Start(commerceContext, this))
{
var result = await _pipeline.Run(args, new CommercePipelineExecutionContextOptions(commerceContext));
return result;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment