public PartialViewResult GetGrindingStock(int BatchID) { var grindingStock = StockLogic.GetGrindingStock(BatchID); if (grindingStock != null) { foreach (var item in grindingStock) { var productStock = StockLogic.GetStockReport(null, null, Convert.ToString(item.ProductID), null, null); if (productStock != null && productStock.Count() > 0) { item.StockQty = Convert.ToString(productStock.FirstOrDefault().ClosingQty); } else { item.StockQty = "0"; } } } return(PartialView("_GrindingStock", grindingStock)); }