public static string GetVendorBalance(int vendorID) { using (AprosysAccountingEntities db = new AprosysAccountingEntities()) { var alpha = db.Report_AccountsPayable(vendorID).FirstOrDefault(); if (alpha != null) { return(alpha.AMOUNT.ToString()); } else { return("0"); } } }