public async Task <ActionResult> PlaceOrder(IEnumerable <CartItem> items) { if (!AccessToken.Valid()) { return(RedirectToAction("Login", "Account")); } Cart cart = new Cart(); cart.CartItems = items.ToList(); OrderDetailsDTO order = await bookstoreService.CreateNewOrder(cart, AccessToken.Get()); if (order == null) { TempData["OrderStatus"] = false; } else { TempData["OrderStatus"] = true; TempData["CreatedOrder"] = order; TempData["Cart"] = cart; Session.Remove("Cart"); } return(RedirectToAction("OrderCreatedResult", "Order")); }
public async Task <OrderDetailsDTO> PlaceOrder() { BookstoreService bookstoreService = new BookstoreService(); return(await bookstoreService.CreateNewOrder(Global.Cart, User.Token)); }