public string GetSubCountyNameBySubCountyId(int subCountyId)
        {
            ILookupCounty lookupCountyRepository = new LookupCountyRepository();

            return
                (lookupCountyRepository.FindBy(c => c.SubcountyId == subCountyId).Take(1).FirstOrDefault().SubcountyName);
        }
        public string GetCountyByCountyId(int countyId)
        {
            ILookupCounty countyRepository = new LookupCountyRepository();
            string        countyName       = countyRepository.FindBy(c => c.CountyId == countyId).Take(1).FirstOrDefault().CountyName;

            return(countyName);
        }
        public List <LookupCounty> GetCounties()
        {
            ILookupCounty countyRepository = new LookupCountyRepository();
            var           list             = countyRepository.GetAll().GroupBy(x => x.CountyId).Select(x => x.First()).OrderBy(l => l.CountyName);

            return(list.ToList());
        }
        public List <LookupCounty> GetWardsList(string subcounty)
        {
            ILookupCounty lookupCountyRepository = new LookupCountyRepository();
            var           myList = lookupCountyRepository.FindBy(x => x.SubcountyName == subcounty);
            var           list   = myList.GroupBy(x => x.WardId).Select(x => x.First()).OrderBy(x => x.WardName);

            return(list.Distinct().ToList());
        }
        public List <LookupCounty> GetSubCounties(string county)
        {
            ILookupCounty lookupCountyRepository = new LookupCountyRepository();
            var           myList = lookupCountyRepository.FindBy(s => s.CountyName == county);
            var           list   = myList.GroupBy(x => x.SubcountyId).Select(x => x.First()).OrderBy(x => x.SubcountyName);

            return(list.ToList());
        }
        public string GetWardNameByWardId(int wardId)
        {
            ILookupCounty lookupCountyRepository = new LookupCountyRepository();

            return(lookupCountyRepository.FindBy(c => c.WardId == wardId).Take(1).FirstOrDefault().WardName);
        }
        public LookupCounty GetCountyDetailsByWardName(string wardName)
        {
            ILookupCounty countyRepository = new LookupCountyRepository();

            return(countyRepository.FindBy(c => c.WardName.ToLower() == wardName.ToLower()).FirstOrDefault());
        }