// GET: ESUNList public ActionResult Index() { string sUrl = ApiAddress + "api/F_D0047_61"; RestClient client = new RestClient(sUrl); RestRequest request = new RestRequest(); IRestResponse <mF_D0047_61> response = client.Execute <mF_D0047_61>(request); mF_D0047_61 oData = response.Data; VMF_D0047_61 vm = new VMF_D0047_61(oData); return(View(vm)); }
/// <summary> /// api/F_D0047_61 /// </summary> /// <returns>mF_D0047_61</returns> public IHttpActionResult GetF_D0047_61() { string sUrl = sApiAddress + sAuthorization + "&elementName=Td&limit=3&locationName=文山區"; RestClient rcClient = new RestClient(sUrl); RestRequest request = new RestRequest(); IRestResponse <List <mF_D0047_61> > response = rcClient.Execute <List <mF_D0047_61> >(request); mF_D0047_61 oData = JsonConvert.DeserializeObject <mF_D0047_61>(response.Content.ToString()); // BAL // DAL return(Ok(oData)); }
public VMF_D0047_61(mF_D0047_61 oData) { sDatasetDescription = oData.records.locations.First().datasetDescription; sLocationsName = oData.records.locations.First().locationsName; sLocationName = oData.records.locations.First().location.First().locationName; sDescription = oData.records.locations.First().location.First().weatherElement.First().description; var oTemp = oData.records.locations.First().location.First().weatherElement.First().time; lTimes = new List <VMTime>(); for (int i = 0; i < oTemp.Count; i++) { VMTime time = new VMTime(); time.sDataTime = oTemp[i].dataTime; time.sValue = oTemp[i].elementValue.First().value; lTimes.Add(time); } }