Esempio n. 1
0
        public JsonResult MaintainMFee([FromBody] MaintainMaitencanceFee model)
        {
            bool   blnResult = false;
            string ErrMsg    = "";

            blnResult = cls.ReksaMaintainMFee(model, out ErrMsg);
            ErrMsg    = ErrMsg.Replace("ReksaMaintainMFee - Core .Net SqlClient Data Provider\n", "");
            return(Json(new { blnResult, ErrMsg }));
        }
Esempio n. 2
0
        public ActionResult MaintainMaintenanceFee([FromBody] MaintainMaitencanceFee model)
        {
            bool   blnResult = false;
            string ErrMsg    = "";

            try
            {
                if (model != null)
                {
                    model.intNIK    = _intNIK;
                    model.strModule = strModule;
                    var Content = new StringContent(JsonConvert.SerializeObject(model));
                    using (HttpClient client = new HttpClient())
                    {
                        client.BaseAddress          = new Uri(_strAPIUrl);
                        Content.Headers.ContentType = new MediaTypeWithQualityHeaderValue("application/json");
                        var     request     = client.PostAsync("/api/Parameter/MaintainMFee", Content);
                        var     response    = request.Result.Content.ReadAsStringAsync().Result;
                        JObject strObject   = JObject.Parse(response);
                        JToken  TokenResult = strObject["blnResult"];
                        JToken  TokenErrMsg = strObject["errMsg"];
                        string  JsonResult  = JsonConvert.SerializeObject(TokenResult);
                        string  JsonErrMsg  = JsonConvert.SerializeObject(TokenErrMsg);
                        blnResult = JsonConvert.DeserializeObject <bool>(JsonResult);
                        ErrMsg    = JsonConvert.DeserializeObject <string>(JsonErrMsg);
                    }
                }
                else
                {
                    ErrMsg = "Error Data : Tidak ada data yang dikirimkan (Model = null)";
                }
            }
            catch (Exception e)
            {
                ErrMsg = e.Message;
            }
            return(Json(new { blnResult, ErrMsg }));
        }