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
resultTypeCartResultTypeThe 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
resultTypeCartResultTypeThe result type.
orderOrderOptional 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
resultTypeCartResultTypeThe result type.
isSuccessboolWhether the command was successful.
dataobjectOptional additional data.
Properties
AllSuccessful
Gets a value indicating whether all operations were successful.
public bool AllSuccessful { get; }
Property Value
AnySuccessful
Gets a value indicating whether any operation was successful.
public bool AnySuccessful { get; }
Property Value
Data
Gets or sets additional data related to the cart command result.
public object? Data { get; set; }
Property Value
ErrorMessages
Gets all error messages.
public IEnumerable<CartMessage> ErrorMessages { get; }
Property Value
Id
Gets or sets the identifier related to this result.
public string? Id { get; set; }
Property Value
IsSuccess
Gets or sets a value indicating whether the cart command was successful.
public bool IsSuccess { get; set; }
Property Value
Messages
Gets a list of messages describing the result.
public Collection<CartMessage> Messages { get; }
Property Value
Name
Gets or sets the name related to this result (e.g., cart name, product name).
public string? Name { get; set; }
Property Value
ResultType
Gets or sets the result type of the cart command execution.
public CartResultType ResultType { get; set; }
Property Value
SuccessMessages
Gets all successful messages.
public IEnumerable<CartMessage> SuccessMessages { get; }
Property Value
Methods
AddErrorMessage(CartResultType)
Adds an error message to this result.
public void AddErrorMessage(CartResultType resultType = CartResultType.Error)
Parameters
resultTypeCartResultTypeThe associated result type.
AddMessage(bool, CartResultType)
Adds a message to this result.
public void AddMessage(bool isSuccess = true, CartResultType resultType = CartResultType.None)
Parameters
isSuccessboolWhether this message represents success.
resultTypeCartResultTypeThe associated result type.
AddSuccessMessage(CartResultType)
Adds a success message to this result.
public void AddSuccessMessage(CartResultType resultType = CartResultType.None)
Parameters
resultTypeCartResultTypeThe associated result type.
Error(object?)
Creates a failed cart command result with an error message.
public static CartCommandResult Error(object? data = null)
Parameters
dataobjectOptional 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
resultTypeCartResultTypeThe result type.
dataobjectOptional additional data.
Returns
- CartCommandResult
A successful cart command result.