// GET: Managers/Analysis public ActionResult ViewSoonToBeExpiredInventory() { List <Batch> ProductsPast75PercentOfShelfLife = ProductsLogic.ProductsPast75PercentOfShelfLife().ToList(); List <AuctionManagementVM> BatchAuctionRecords = new List <AuctionManagementVM>(); foreach (var item in ProductsPast75PercentOfShelfLife) { if (Auctionrepo.GetAll(x => x.BatchId == item.Id) != null) { BatchAuctionRecords.Add(new AuctionManagementVM() { Batch = item, State = BatchAuctionState.OnAuction }); } else if (ToBeAuctionedRepo.GetAll(x => x.BatchId == item.Id && x.HasBeenReviewedByManager == true) != null) { BatchAuctionRecords.Add(new AuctionManagementVM() { Batch = item, State = BatchAuctionState.AboutToBeAuctioned }); } else if (ToBeAuctionedRepo.GetAll(x => x.BatchId == item.Id && x.HasBeenReviewedByManager == false) != null) { BatchAuctionRecords.Add(new AuctionManagementVM() { Batch = item, State = BatchAuctionState.NotReviewed }); } } return(View(BatchAuctionRecords)); }