예제 #1
0
        public ActionResult MaintainNasabah([FromBody] MaintainNasabah model)
        {
            bool      blnResult = false;
            string    ErrMsg    = "";
            DataTable dtError   = new DataTable();

            try
            {
                string[] selectedId;
                model.SelectedId = (model.SelectedId + "***").Replace("|***", "");
                selectedId       = model.SelectedId.Split('|');

                var sessionDataset = _session.GetString("listConfAdress");
                List <KonfirmasiAddressModel> listConfAdress = JsonConvert.DeserializeObject <List <KonfirmasiAddressModel> >(sessionDataset);

                List <KonfirmasiAddressModel> filteredList = new List <KonfirmasiAddressModel>();
                int intselectedId = 0;
                foreach (string s in selectedId)
                {
                    int.TryParse(s, out intselectedId);
                    filteredList = listConfAdress.Where(m => (m.Sequence == intselectedId)).ToList();
                }
                model.KonfirmasiAddressModel = filteredList;
                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/Customer/MaintainNasabah?NIK=" + _intNIK + "&GUID=" + _strGuid, Content);
                    var     response  = request.Result.Content.ReadAsStringAsync().Result;
                    JObject strObject = JObject.Parse(response);
                    blnResult = strObject.SelectToken("blnResult").Value <bool>();
                    ErrMsg    = strObject.SelectToken("errMsg").Value <string>();
                    JToken TokenError = strObject["dtError"];
                    string JsonError  = JsonConvert.SerializeObject(TokenError);
                    dtError = JsonConvert.DeserializeObject <DataTable>(JsonError);
                }
            }
            catch (Exception e)
            {
                ErrMsg = e.Message;
                return(Json(new { blnResult, ErrMsg, dtError }));
            }
            return(Json(new { blnResult, ErrMsg, dtError }));
        }
예제 #2
0
        public JsonResult MaintainNasabah([FromQuery] int NIK, [FromQuery] string GUID, [FromBody] MaintainNasabah model)
        {
            bool   blnResult = false;
            string ErrMsg    = "";

            DataTable dtError = new DataTable();

            blnResult = cls.ReksaMaintainNasabah(model, NIK, GUID, out ErrMsg, out dtError);
            ErrMsg    = ErrMsg.Replace("ReksaMaintainNasabah - Core .Net SqlClient Data Provider\n", "");
            return(Json(new { blnResult, ErrMsg, dtError }));
        }