public ActionResult CatalogueListForDelete(string subcategory) { MainApplication model = new MainApplication(); var details = _CatalogueService.GetCataloguesBySubCategory(subcategory); List <Catalogue> catlist = new List <Catalogue>(); foreach (var data in details) { var entrystock = _EntryStockItemService.getDetailsByItemCode(data.ItemCode); var openingstock = _OpeningStockService.GetDataByItemCode(data.ItemCode); var inwarddetails = _InwardItemFromSupplierService.GetItemDetailsByItemCode(data.ItemCode); if (entrystock == null && openingstock == null && inwarddetails == null) { catlist.Add(data); } } model.CatalogueList = catlist; return(View(model)); }