Esempio n. 1
0
        public IActionResult GoLive(AdminPendingProductsViewModel model)
        {
            InventoryItem item = _unitOfWork.InventoryItems.InventoryItems.FirstOrDefault(x => x.InventoryItemID == model.InventoryItemID);

            item.GoLive = true;
            ProductPriceComponents component = _unitOfWork.PriceComponents.PriceComponents
                                               .FirstOrDefault(x => x.InventoryItemID == item.InventoryItemID);

            component.SalePrice = model.SalePrice;

            _unitOfWork.InventoryItems.UpdateInventoryItem(item);
            _unitOfWork.PriceComponents.UpdatePriceComponent(component);

            return(RedirectToAction(nameof(PendingProducts)));
        }
Esempio n. 2
0
        //[HttpPost]
        //public IActionResult GoLive(InventoryItem item)
        //{
        //    item.GoLive = true;
        //    _unitOfWork.InventoryItems.UpdateInventoryItem(item);
        //    return RedirectToAction(nameof(PendingProducts));
        //}

        public async Task <IActionResult> PendingProducts()
        {
            var            users      = _userManager.Users;
            List <AppUser> AllSellers = new List <AppUser>();

            foreach (AppUser user in users)
            {
                if (await _userManager.IsInRoleAsync(user, "Seller"))
                {
                    AllSellers.Add(user);
                }
            }

            AdminPendingProductsViewModel pendingProducts = new AdminPendingProductsViewModel
            {
                Sellers = AllSellers,
                PendingInventoryItems    = _unitOfWork.InventoryItems.InventoryItems.Where(x => x.GoLive == false),
                PriceComponentRepository = _unitOfWork.PriceComponents
            };

            return(View(pendingProducts));
        }