Deleting Entities in your SXC Plugin

If you're ever creating a plugin that needs to delete an entity and you're checking out source codes from other plugins you might be wondering where the pipeline and command declarations for the delete methods are. It turns out the command is already defined in the base CommerceController and calls default functionality to remove the entity. If you need to conduct any complex operations you'll want to look at creating your own pipeline and calling it, but for simple scenarios (like wish Lists) a simple default will suffice!

public virtual IActionResult Delete(string id)
    Logger.LogInformation(string.Format("CommerceController_Delete: {0}", id), Array.Empty<object>());
    var result = Command<DeleteEntityCommand>().Process(CurrentContext, id);
    return new NoContentResult();