public async Task <IActionResult> CreateOrderFromCart([FromBody] OrderViewModel order, CancellationToken requestAborted) { _logger.LogInformation("POST request for 'api/order/'"); var addedOrder = new Order { Address = order.Address, City = order.City, Country = order.Country, Email = order.Email, FirstName = order.FirstName, LastName = order.LastName, OrderDate = DateTime.Today, Phone = order.Phone, PostalCode = order.PostalCode, State = order.State, Username = GetCartId(), Total = 0 }; // Add it to the order var viewModel = await _cartCommandService.CreateOrderFromCart(GetCartId(), addedOrder, requestAborted); // Return the order json return(Json(viewModel)); }
public async Task <IActionResult> CreateOrderFromCart([FromBody] OrderViewModel order) { var addedOrder = new Order { Address = order.Address, City = order.City, Country = order.Country, Email = order.Email, FirstName = order.FirstName, LastName = order.LastName, OrderDate = DateTime.Today, Phone = order.Phone, PostalCode = order.PostalCode, State = order.State ?? "NA", Username = GetCartId(), Total = 0 }; // Add it to the order var viewModel = await _cartCommandService.CreateOrderFromCart(GetCartId(), addedOrder, order.StripeToken, _appSettings.Stripe.SecretKey); // Return the order json return(Json(viewModel)); }