public async Task <IActionResult> Create() { IEnumerable <BasketItemDto> basketItems = null; try { basketItems = await _basketFacade.GetBasket(1); /*basketItems = await _basketFacade.GetBasket(customerId);*/ } catch (HttpRequestException) { _logger.LogWarning("Exception Occured using Basket Facade"); basketItems = null; } double totalPrice = 0; foreach (BasketItemDto item in basketItems) { totalPrice = totalPrice + (item.Price * item.Quantity); } ; try { OrderDto newOrder = new OrderDto { CustomerId = 1, /* CustomerId = customerId,*/ Date = DateTime.Now, OrderedItems = basketItems.Select(i => new OrderedItemDto { ProductId = i.ProductId, ProductName = i.ProductName, Quantity = i.Quantity, Price = i.Price, }).ToList(), TotalPrice = totalPrice }; await _orderFacade.NewOrder(newOrder); } catch (HttpRequestException) { _logger.LogWarning("Exception Occured using Order Facade"); } return(RedirectToAction("index", "basket")); }