public async Task <int> Checkout(string customerId, RegistrationViewModel input) { if (string.IsNullOrWhiteSpace(customerId)) { throw new ArgumentNullException(nameof(customerId)); } if (input == null) { throw new ArgumentNullException(nameof(input)); } CustomerBasket basket = _repository.GetBasket(customerId); var order = new Order(basket.Items.Select(i => new OrderItem(i)).ToList() , customerId, input.Name, input.Email, input.Phone , input.Address, input.AdditionalAddress, input.District , input.City, input.State, input.ZipCode); var newOrder = await _orderingServices.CreateOrUpdateAsync(order); _repository.DeleteBasket(customerId); return(newOrder.Id); }