public ActionResult ItemApproval()
        {
            if (Session["isAdmin"] == null || !(bool)Session["isAdmin"])
                return RedirectToAction("Index", new { controller = "Home", action = "Index" });
            var allItems = db.Items.Where(item => item.CheckedOutById != null);         //Items checked out or returned
            var pendingApprovalItems = allItems.Where(item => item.CheckedInById != null); //Items checked out and in
            pendingApprovalItems = pendingApprovalItems.Where(item => item.IsReturned == true);
            if (pendingApprovalItems.ToList().Count == 0)
            {
                TempData["error"] = "No items currently pending approval";
                return RedirectToAction("Index");
            }
            IList<bool> itemsLost = new List<bool>();
            IList<bool> itemReturn = new List<bool>();

            foreach (var item in pendingApprovalItems)
            {
                itemReturn.Add(true);
                itemsLost.Add(false);
            }
            ItemsApproveViewModel vm = new ItemsApproveViewModel
            {
                PendingApprovalItems = pendingApprovalItems.OrderBy(item => item.InventoryLocation.InventoryLocationName).ThenBy(item => item.ItemType.ItemName).ThenBy(item => item.Label!=null? item.Label.LabelName : "").ToList(),
                ItemReturn = itemReturn,
                ItemsLost = itemsLost
            };
            return View(vm);
        }
        public ActionResult ApproveItems(ItemsApproveViewModel vm)
        {
            if (Session["isAdmin"] == null || !(bool)Session["isAdmin"])
                return RedirectToAction("Index", new { controller = "Home", action = "Index" });
            if (vm == null)
                return RedirectToAction("Index");

            if (!CheckReturnedAndLost(vm.PendingApprovalItems, vm.ItemsLost, vm.ItemReturn))
            {
                TempData["error"] = "An item cannot be marked as lost and returned";
                return RedirectToAction("Index");
            }
            if (!UpdateItems(vm.PendingApprovalItems, vm.ItemsLost, vm.ItemReturn))
            {
                TempData["error"] = "Item not found, cannot continue";
                return RedirectToAction("Index");
            }
            return RedirectToAction("Index");
        }