public async Task <IActionResult> Checkout(BasketCheckout basketCheckot) { var basket = await _repo.GetUserBasket(basketCheckot.UserName); if (basket == null) { return(NotFound("Could Not Find User Basket")); } var basketDeleted = await _repo.DeleteUserBasket(basketCheckot.UserName); if (!basketDeleted) { return(BadRequest("Coud not Delete User Basket")); } var basketEvent = _mapper.Map <BasketCheckoutEvent>(basketCheckot); basketEvent.RequestId = Guid.NewGuid(); basketEvent.TotalPrice = basket.TotalPrice; _eventBus.PublishBasketCheckout(EventBusConstants.BasketCheckoutQueue, basketEvent); return(Accepted()); }