示例#1
0
        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));
            }
        }