Table of Contents

Class CartCommandResult

Namespace
Dynamicweb.Ecommerce.Frontend.Cart
Assembly
Dynamicweb.Ecommerce.dll

Represents the result of a cart command execution with extensible properties.

public sealed class CartCommandResult
Inheritance
CartCommandResult
Inherited Members

Constructors

CartCommandResult()

Initializes a new instance of the CartCommandResult class.

public CartCommandResult()

CartCommandResult(CartResultType)

Initializes a new instance of the CartCommandResult class with the specified result type.

public CartCommandResult(CartResultType resultType)

Parameters

resultType CartResultType

The result type.

CartCommandResult(CartResultType, Order?)

Initializes a new instance of the CartCommandResult class with the specified result type and order.

public CartCommandResult(CartResultType resultType, Order? order)

Parameters

resultType CartResultType

The result type.

order Order

Optional order used to populate message metadata.

CartCommandResult(CartResultType, bool, object?)

Initializes a new instance of the CartCommandResult class with the specified parameters.

public CartCommandResult(CartResultType resultType, bool isSuccess, object? data = null)

Parameters

resultType CartResultType

The result type.

isSuccess bool

Whether the command was successful.

data object

Optional additional data.

Properties

AllSuccessful

Gets a value indicating whether all operations were successful.

public bool AllSuccessful { get; }

Property Value

bool

AnySuccessful

Gets a value indicating whether any operation was successful.

public bool AnySuccessful { get; }

Property Value

bool

Data

Gets or sets additional data related to the cart command result.

public object? Data { get; set; }

Property Value

object

ErrorMessages

Gets all error messages.

public IEnumerable<CartMessage> ErrorMessages { get; }

Property Value

IEnumerable<CartMessage>

Id

Gets or sets the identifier related to this result.

public string? Id { get; set; }

Property Value

string

IsSuccess

Gets or sets a value indicating whether the cart command was successful.

public bool IsSuccess { get; set; }

Property Value

bool

Messages

Gets a list of messages describing the result.

public Collection<CartMessage> Messages { get; }

Property Value

Collection<CartMessage>

Name

Gets or sets the name related to this result (e.g., cart name, product name).

public string? Name { get; set; }

Property Value

string

ResultType

Gets or sets the result type of the cart command execution.

public CartResultType ResultType { get; set; }

Property Value

CartResultType

SuccessMessages

Gets all successful messages.

public IEnumerable<CartMessage> SuccessMessages { get; }

Property Value

IEnumerable<CartMessage>

Methods

AddErrorMessage(CartResultType)

Adds an error message to this result.

public void AddErrorMessage(CartResultType resultType = CartResultType.Error)

Parameters

resultType CartResultType

The associated result type.

AddMessage(bool, CartResultType)

Adds a message to this result.

public void AddMessage(bool isSuccess = true, CartResultType resultType = CartResultType.None)

Parameters

isSuccess bool

Whether this message represents success.

resultType CartResultType

The associated result type.

AddSuccessMessage(CartResultType)

Adds a success message to this result.

public void AddSuccessMessage(CartResultType resultType = CartResultType.None)

Parameters

resultType CartResultType

The associated result type.

Error(object?)

Creates a failed cart command result with an error message.

public static CartCommandResult Error(object? data = null)

Parameters

data object

Optional additional data.

Returns

CartCommandResult

A failed cart command result.

Success(CartResultType, object?)

Creates a successful cart command result with the specified result type.

public static CartCommandResult Success(CartResultType resultType, object? data = null)

Parameters

resultType CartResultType

The result type.

data object

Optional additional data.

Returns

CartCommandResult

A successful cart command result.

To top