public override Task <ICreateClientResult> Work(CreateClientCmd Op, Unit state) { //if (Exists(Op.ClientId)) //{ // return Task.FromResult<ICreateClientResult>(new ClientNotCreated("Client already exists!")); //} //else //{ ClientAgg newClient = new ClientAgg(new Client() { FirstName = Op.FirstName, LastName = Op.LastName, Email = Op.Email, Phone = Op.Phone, CardNumber = Op.CardNumber, ClientId = Op.ClientId, Password = Op.Password }); return(Task.FromResult <ICreateClientResult>(new ClientCreated(newClient))); //} }
public bool ClientExists(ClientAgg client) => client != null;
public ClientCreated(ClientAgg client) { ClientAgg = client; }
public ChangeQuantityCmd(ClientAgg clientAgg, CartItem item, uint quantity) { CartItem = item; NewQuantity = quantity; ClientAgg = clientAgg; }
public ClientSelected(ClientAgg client) { ClientAgg = client; }
public static IO <IRequestPaymentResult> RequestPayment(ClientAgg clientAgg) => NewIO <RequestPaymentOp.RequestPaymentCmd, IRequestPaymentResult>(new RequestPaymentOp.RequestPaymentCmd(clientAgg));
public static IO <ISetOrderStatusResult> SetOrderStatus(ClientAgg clientAgg, CartStatus newStatus) => NewIO <SetOrderStatusOp.SetOrderStatusCmd, ISetOrderStatusResult>(new SetOrderStatusOp.SetOrderStatusCmd(clientAgg, newStatus));
public static IO <IChangeQuantityResult> ChangeQuantity(ClientAgg clientAgg, CartItem cartItem, uint quantity) => NewIO <ChangeQuantityOp.ChangeQuantityCmd, IChangeQuantityResult>(new ChangeQuantityOp.ChangeQuantityCmd(clientAgg, cartItem, quantity));
//============================================= Others =========================================================== public static IO <IAddToCartResult> AddItemsToCart(ClientAgg clientAgg, List <CartItem> items) => NewIO <AddToCartOp.AddToCartCmd, IAddToCartResult>(new AddToCartOp.AddToCartCmd(clientAgg, items));
public ClientFound(ClientAgg agg) { Agg = agg; }
public ClientUpdated(ClientAgg client) { ClientAgg = client; }
public RequestPaymentCmd(ClientAgg clientAgg) { ClientAgg = clientAgg; }
public AddToCartCmd(ClientAgg client, List <CartItem> items) { Client = client; CartItems = items; }
public SetOrderStatusCmd(ClientAgg client, CartStatus newStatus) { ClientAgg = client; CartStatus = newStatus; }
public PaymentRequested(ClientAgg client) { ClientAgg = client; }