public IHttpActionResult GetResultDetail(string searchCriteria, string radius, string parcel_type, string shapes, string object_id, string changwatCode, string amphurCode, string tumbonCode, string x, string y, string branchCode) { var repos = new TDAssetRespository(); var result = new List <dynamic>(); var _shapes = JsonConvert.DeserializeObject <List <dynamic> >(Convert.ToString(shapes)); var branchCodes = JsonConvert.DeserializeObject <string[]>(Convert.ToString(branchCode)); switch (parcel_type) { case "1": //CHANOD result = repos.GetChanods(_shapes, changwatCode, radius, branchCodes); break; case "2": //NS3K result = repos.GetNS3Ks(_shapes, changwatCode, radius, branchCodes); break; default: return(NotFound()); } var poi = searchCriteria == "condition" ? repos.GetPOI(object_id) : new POI { NAME_T = "ข้อมูลแปลงที่ดินโดยรวม", }; return(Json(new { OBJECT_ID = Convert.ToInt32(object_id), NAME = Convert.ToString(poi.NAME_T), TOTAL_PARCEL_COUNT = string.Format("{0:N0}", result.Count()), TOTAL_AREA_RAI = string.Format("{0:N2}", result.Select <dynamic, int>(hd => Convert.ToInt16(hd.NRAI)).Sum() * 400), TOTAL_VAL_AMT = string.Format("{0:N2}", result.Select <dynamic, decimal>(o => Convert.ToDecimal(o.VAL_AMT)).Sum()), })); }