public ActionResult CheckoutConfirmed()
        {
            CurrentUser = UserManager.FindById(System.Web.HttpContext.Current.User.Identity.GetUserId());
            List <OrderProduct> orderProducts = _orderProductRepository.GetEntities()
                                                .Where(p => p.UserId == this.CurrentUser.Id).ToList();

            if (!BalanceOperations.CanBuy(orderProducts, CurrentUser.Balance))
            {
                TempData["Error"] = "Insufficient credits!";
                return(RedirectToAction("Index"));
            }
            CurrentUser.Balance -= BalanceOperations.GetPrice(orderProducts);
            UserManager.Update(CurrentUser);

            var inventoryController = DependencyResolver.Current.GetService <InventoryController>();

            inventoryController.ControllerContext = new ControllerContext(this.Request.RequestContext, inventoryController);

            inventoryController.Add(orderProducts);

            foreach (OrderProduct product in orderProducts)
            {
                _orderProductRepository.Delete(product.OrderProductId);
            }
            _orderProductRepository.Save();


            return(RedirectToAction("Index", "Inventory"));
        }
 private void OnRowItemCreated(UIElement obj)
 {
     if (obj.RenderSize.Height > 0 && gridHeight > 0 && HistoryrowHeight <= 0)
     {
         HistoryrowHeight  = obj.RenderSize.Height;
         pagesize          = (int)(gridHeight / HistoryrowHeight);
         BalanceOperations = BalanceOperations.Take(pagesize).ToList();
         UpdateHistoryTotal(Total);
     }
 }
        // GET: Cart
        public ActionResult Index()
        {
            CurrentUser = UserManager.FindById(System.Web.HttpContext.Current.User.Identity.GetUserId());
            List <OrderProduct> orderedProducts = _orderProductRepository.GetEntities().Where(p => p.UserId == this.CurrentUser.Id).ToList();
            CartViewModel       model           = new CartViewModel()
            {
                OrderProducts = orderedProducts,
                Price         = BalanceOperations.GetPrice(orderedProducts)
            };

            return(View(model));
        }