public bool isLedgerExists(int AirlineId) { var aa = Airlines.Where(x => x.AirlineId == AirlineId).FirstOrDefault(); if (aa.SettlmentLedgerId == null) { return(false); } else { if (ent.GL_Ledgers.Where(x => x.Id == AirlineId && x.AccTypeId == 1).ToList().Count == 0) { return(false); } else { return(true); } } }