public ActionResult Purchase(int itemList, double total) { CustomerOrderHistory coh = new CustomerOrderHistory(); coh.LocId = (int)HttpContext.Session.GetInt32("LocId"); coh.CustId = _customerBL.GetCustomerByEmail(HttpContext.Session.GetString("UserEmail")).Id; coh.OrderDate = DateTime.Now; coh.OrderId = itemList; coh.Total = total; _customerOrderHistoryBL.AddCustomerOrderHistory(coh); CustomerCart cart = new CustomerCart(); /*cart.CustId = coh.CustId; * cart.LocId = coh.LocId;*/ cart = _cartBL.GetCustomerCartByIds(coh.CustId, coh.LocId); cart.CurrentItemsId = _orderLineItemBL.Ident_Curr() + 1; _cartBL.UpdateCustomerCart(cart); CustomerOrderLineItem orderLineItem = new CustomerOrderLineItem(); orderLineItem.OrderId = cart.CurrentItemsId; orderLineItem.ProdId = null; orderLineItem.Quantity = 0; orderLineItem.ProdPrice = 0; _orderLineItemBL.AddCustomerOrderLineItem(orderLineItem); return(Redirect($"/InventoryLineItem?locId={HttpContext.Session.GetInt32("LocId")}")); }
public void CreateCustomerOrderHistory() { _customerOrderHistory.AddCustomerOrderHistory(GetOrderDetails()); }