public void PlaceOrder(Guid customerId, string productCode, int quantity) { var result = PotentialOrder.BuildOrder(customerId, productCode, quantity); _uow.Repository.Save(result.Entity); _uow.Bus.Publish(result.Event); _uow.Commit(); }
public IActionResult Post(PlaceOrderRequest request) { if (!PotentialOrder.CanBePlaced(request.customerId, request.productCode, request.quantity)) { return(BadRequest(PotentialOrder.GetPlacingErrors(request.customerId, request.productCode, request.quantity))); } _service.PlaceOrder(request.customerId, request.productCode, request.quantity); return(Ok()); }