Retructured solution
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
namespace LiteCharms.Features.ShoppingCarts.Commands;
|
||||
|
||||
public class AddPackageToShoppingCartCommand : IRequest<Result>
|
||||
{
|
||||
public Guid ShoppingCartId { get; set; }
|
||||
|
||||
public Guid PackageId { get; set; }
|
||||
|
||||
private AddPackageToShoppingCartCommand(Guid shoppingCartId, Guid packageId)
|
||||
{
|
||||
ShoppingCartId = shoppingCartId;
|
||||
PackageId = packageId;
|
||||
}
|
||||
|
||||
public static AddPackageToShoppingCartCommand Create(Guid shoppingCartId, Guid packageId)
|
||||
{
|
||||
if (shoppingCartId == Guid.Empty)
|
||||
throw new ArgumentException($"Shopping cart ID is required", nameof(shoppingCartId));
|
||||
|
||||
if (packageId == Guid.Empty)
|
||||
throw new ArgumentException($"Package ID is required", nameof(packageId));
|
||||
|
||||
return new(shoppingCartId, packageId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user