public JsonResult RefreshMaintenanceFee(int ProdukId) { bool blnResult = false; string ErrMsg = ""; List <ParamMFeeModel> listReksaParamMFee = new List <ParamMFeeModel>(); List <ProductMFeeModel> listReksaProductMFees = new List <ProductMFeeModel>(); List <ListGLMFeeModel> listReksaListGLMFee = new List <ListGLMFeeModel>(); ParamMFeeModel listFee = new ParamMFeeModel(); try { using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(_strAPIUrl); MediaTypeWithQualityHeaderValue contentType = new MediaTypeWithQualityHeaderValue("application/json"); client.DefaultRequestHeaders.Accept.Add(contentType); HttpResponseMessage response = client.GetAsync("/api/Parameter/PopulateMFee?NIK=" + _intNIK + "&strModule=" + strModule + "&ProdId=" + ProdukId + "&TrxType=MFEE").Result; string stringData = response.Content.ReadAsStringAsync().Result; JObject strObject = JObject.Parse(stringData); blnResult = strObject.SelectToken("blnResult").Value <bool>(); ErrMsg = strObject.SelectToken("errMsg").Value <string>(); JToken strTokenParamMFee = strObject["listReksaParamMFee"]; JToken strTokenProduct = strObject["listReksaProductMFees"]; JToken strTokenGL = strObject["listReksaListGLMFee"]; string strJsonParamMFee = JsonConvert.SerializeObject(strTokenParamMFee); string strJsonProduct = JsonConvert.SerializeObject(strTokenProduct); string strJsonGL = JsonConvert.SerializeObject(strTokenGL); listReksaParamMFee = JsonConvert.DeserializeObject <List <ParamMFeeModel> >(strJsonParamMFee); listReksaProductMFees = JsonConvert.DeserializeObject <List <ProductMFeeModel> >(strJsonProduct); listReksaListGLMFee = JsonConvert.DeserializeObject <List <ListGLMFeeModel> >(strJsonGL); } ParameterMFeeListViewModel vModel = new ParameterMFeeListViewModel(); if (listReksaParamMFee.Count > 0) { listFee = listReksaParamMFee[0]; vModel.ParamMFee = listFee; vModel.ProductMFee = listReksaProductMFees; vModel.ListGLMFee = listReksaListGLMFee; } else { listFee.PeriodEfektif = 0; listFee.prodId = 0; } vModel.ParamMFee = listFee; vModel.ProductMFee = listReksaProductMFees; vModel.ListGLMFee = listReksaListGLMFee; } catch (Exception e) { ErrMsg = e.Message; } return(Json(new { blnResult, ErrMsg, listFee, listReksaProductMFees, listReksaListGLMFee })); }
public IActionResult MaintenanceFee() { ParameterMFeeListViewModel vModel = new ParameterMFeeListViewModel(); return(View(vModel)); }