public ActionResult Index(string orderTotal)
 {
     decimal _orderTotal = Convert.ToDecimal(orderTotal.TrimStart('$').Trim());
     OrderViewModel _model = new OrderViewModel();
     _model.Total = _orderTotal;
     return View(_model);
 }
        public ActionResult Index(OrderViewModel order)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("", "Please fix error before proceeding!");
                return View(order);
            }

            Order _order = new Order();
            _order.OrderDate = DateTime.Today.Date;
            _order.Username = System.Web.HttpContext.Current.Session["USER_NAME"].ToString();
            _order.FirstName = order.FirstName;
            _order.LastName = order.LastName;
            _order.Address = order.Address;
            _order.City = order.City;
            _order.State = order.State;
            _order.PostalCode = order.PostalCode;
            _order.Country = order.Country;
            _order.Email = order.Email;
            _order.Phone = order.Phone;
            _order.HasBeenShipped = false;
            _order.Total = order.Total;

            _repository.AddOrder(_order);

            var _shoppingCartDetails = _repository.GetShoppingCartDetails();

            for (int i = 0; i < _shoppingCartDetails.Count; i++)
            {
                OrderDetail _orderDetails = new OrderDetail();
                _orderDetails.OrderId = _order.OrderId;
                _orderDetails.Username = System.Web.HttpContext.Current.Session["USER_NAME"].ToString();
                _orderDetails.ProductId = _shoppingCartDetails[i].ProductID;
                _orderDetails.Quantity = _shoppingCartDetails[i].Quantity;
                _orderDetails.UnitPrice = _shoppingCartDetails[i].Price;

                _repository.AddOrderDetails(_orderDetails);
            }

            return RedirectToAction("ReviewOrder", new { orderID = _order.OrderId });
        }