Last active
October 9, 2017 14:08
-
-
Save websterian/c6a2dc4a6484502b8eb9a8cbdb3dd8bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Sitecore.Commerce.Plugin.AdventureWorks.Pipelines.Blocks | |
{ | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.OData.Builder; | |
using Sitecore.Commerce.Core; | |
using Sitecore.Commerce.Core.Commands; | |
using Sitecore.Framework.Conditions; | |
using Sitecore.Framework.Pipelines; | |
/// <summary> | |
/// The Configure Service Api Block. | |
/// </summary> | |
public class ConfigureServiceApiBlock : PipelineBlock<ODataConventionModelBuilder, ODataConventionModelBuilder, CommercePipelineExecutionContext> | |
{ | |
/// <summary> | |
/// The _pipeline. | |
/// </summary> | |
private readonly IPersistEntityPipeline _pipeline; | |
public ConfigureServiceApiBlock(IPersistEntityPipeline persistEntityPipeline) | |
{ | |
this._pipeline = persistEntityPipeline; | |
} | |
public override Task<ODataConventionModelBuilder> Run(ODataConventionModelBuilder modelBuilder, CommercePipelineExecutionContext context) | |
{ | |
Condition.Requires(modelBuilder).IsNotNull($"{base.Name}: The argument can not be null"); | |
var configuration = modelBuilder.Action("SetCartVIPStatus"); | |
configuration.Parameter<string>("cartId"); | |
configuration.Parameter<bool>("applyVIPStatus"); | |
configuration.ReturnsFromEntitySet<CommerceCommand>("Commands"); | |
return Task.FromResult(modelBuilder); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment