Exemplo n.º 1
0
        public string FindByTextToJson(string text)
        {
            var merge = (from subdist in _subdistrict.SubDistrictData()
                         join dist in _district.DistrictData() on subdist.DistrictId equals dist.DistrictId
                         join pro in _province.ProvinceData() on dist.ProvinceId equals pro.ProvinceId
                         join pos in _postcode.PostcodeData() on dist.DistrictId equals pos.DistrictId
                         join reg in _region.RegionData() on pro.RegionId equals reg.RegionId
                         where subdist.SubDistrictNameTh.Contains(text) || subdist.SubDistrictNameEn.Contains(text) ||
                         dist.DistrictNameTh.Contains(text) || dist.DistrictNameEn.Contains(text) ||
                         pro.ProvinceNameTh.Contains(text) || pro.ProvinceNameEn.Contains(text) ||
                         pos.Postcode.Contains(text)
                         select new { subdist, dist, pro, pos, reg });
            var result = merge.GroupBy(x => x.dist.DistrictId).Select(g => g.First());

            return(JsonConvert.SerializeObject(result));
        }
 public void PostcodeDataIsNotNull()
 {
     Assert.NotNull(_postcode.PostcodeData());
 }
Exemplo n.º 3
0
 /// <summary>
 /// Get all postcode
 /// </summary>
 /// <returns>Json format</returns>
 public string GetPostcodeToJson()
 {
     return(JsonConvert.SerializeObject(_postcode.PostcodeData()));
 }