This file contains hidden or 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
using System.Web.Mvc; | |
using Sitecore.Commerce.Core; | |
using Sitecore.Framework.Pipelines; | |
using System.Threading.Tasks; | |
namespace Products.Plugin.Cart | |
{ | |
[PipelinesDisplayName("Products.Plugin.SAPConfigureServiceApiBlock")] | |
public class ConfigureServiceApiBlock : PipelineBlock<ODataConventionModelBuilder, ODataConventionModelBuilder, CommercePipelineExecutionContext> | |
{ |
This file contains hidden or 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
using System.Web.Mvc; | |
using Sitecore.Commerce.Core; | |
namespace Products.Plugin.Cart | |
{ | |
public class CommandsController : CommereceController | |
{ | |
public CommandsController(IServiceProvider serviceProvider, CommerceEnvironment globalEnvironment) : base(serviceProvider, globalEnvironment) | |
{ | |
} |
This file contains hidden or 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
<?xml version="1.0"?> | |
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> | |
<sitecore> | |
<pipelines> | |
<initialize> | |
<processor type="Sitecore.Feature.Pipelines.RegisterWebApiRoutes, SC.Feature" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']" resolve="true" /> | |
</initialize> | |
</pipelines> | |
</sitecore> | |
</configuration> |
This file contains hidden or 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.Feature.Pipelines | |
{ | |
using System.Web.Mvc; | |
using System.Web.Routing; | |
using Sitecore.Pipelines; | |
public class RegisterWebApiRoutes | |
{ | |
public void Process(PipelineArgs args) | |
{ |
This file contains hidden or 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
[HttpGet] | |
public JsonResult GetEventList(int startIndex = 1, int pageSize = 10, string lang="en") | |
{ | |
Sitecore.Globalization.Language language = Sitecore.Globalization.Language.Parse(lang); | |
var item = Sitecore.Context.Database.GetItem(ServiceUtility.Item.EventId, language); | |
var Etype = string.Empty; | |
var EFor = string.Empty; | |
var Eyear = string.Empty; | |
var items = this.EventRepository.AllEvent(startIndex, pageSize, item, Etype, EFor, Eyear); | |
APIEventList eventList = APIMapper.GetEventList(items.Listofdata, lang); |
This file contains hidden or 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 SC.Feature.Controllers | |
{ | |
[AllowCrossSite] | |
public class EventController : Controller | |
{ | |
//Code Here | |
} | |
} |
This file contains hidden or 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
public class AllowCrossSiteAttribute : ActionFilterAttribute | |
{ | |
public override void OnActionExecuting(ActionExecutionContext filterContext) | |
{ | |
filterContext.RequestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Origin", "*"); | |
filterContext.RequestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Headers", "*"); | |
filterContext.RequestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Credentials", "*"); | |
base.OnActionExecuting(filterContext); | |
} |
This file contains hidden or 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
foreach (CartLineComponent item in arg.Lines) | |
{ | |
var productArgument = ProductArgument.FromItemId(item.ItemId); | |
if (!productArgument.IsValid()) continue; | |
var sellableItem = getSellableItemPipeline.Run(productArgument, context).Result; | |
if (sellableItem.FriendlyId == SitecoreConstants.ProductFriendlyIdForReorder && arg != null && item.HasComponent<CartExtensionComponent>()) | |
{ | |
CartExtensionComponent CartExtensionComponent = item.GetComponent<CartExtensionComponent>(); | |
} | |
} |
This file contains hidden or 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 Products.Plugin.Cart | |
{ | |
using Sitecore.Commerce.Core; | |
public class CartLineComponent : Component | |
{ | |
public string Productid { get; set; } | |
public string ItemId { get; set; } | |
public string UnitPrice { get; set; } | |
} |
This file contains hidden or 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
public class RegularExpressionTranslated : RegularExpressionAttribute, IClientValidatable | |
{ | |
public RegularExpressionTranslated(string pattern) : base(pattern) | |
{ | |
} | |
public RegexOptions RegexOptions { get; set; } | |
public override bool IsValid(object value) | |
{ |
NewerOlder