public IActionResult DeactiveShelf(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var shelf = ctx.GetShelf(id);

            if (shelf == null)
            {
                return(NotFound());
            }
            var        cells         = ctx.GetAllCellById(shelf.ShelfId);
            List <int> packCountList = new List <int>();

            foreach (var cell in cells)
            {
                //int packageCount = ctx.Packages.Count(p => p.CellId == cell.CellId);
                int packageCount = ctx.PackageCountById(cell.CellId);
                packCountList.Add(packageCount);
            }
            int totalInList = 0;

            packCountList.ForEach(item =>
            {
                totalInList += item;
            });
            if (totalInList == 0)
            {
                return(PartialView("DeactiveShelf", shelf));
            }
            else
            {
                return(PartialView("DeactiveFail", shelf));
            }
        }
Exemple #2
0
        public IViewComponentResult Invoke(string shelfId = "")
        {
            int countPackageInShelf = 0;
            var cells = ctx.GetAllCellById(shelfId);

            cells.ForEach(cell =>
            {
                if (ctx.PackageInCell(cell.CellId))
                {
                    countPackageInShelf++;
                }
            });
            int         cellNumber = ctx.CellCount(shelfId);
            ShelfStatus ss         = new ShelfStatus
            {
                PackageCountInShelf = countPackageInShelf,
                CellNumber          = cellNumber
            };

            return(View(ss));
        }