Skip to content

Instantly share code, notes, and snippets.

@websterian
Created December 17, 2018 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save websterian/a050b6bda24f55049139770581adf9cf to your computer and use it in GitHub Desktop.
Save websterian/a050b6bda24f55049139770581adf9cf to your computer and use it in GitHub Desktop.
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