public ActionResult SaveItems(List <SchedulColumnDetailModel> Items) { if (_ICon.ConInit(out str_msg) && Items != null) { if (Items.Count > 0) { List <string[]> arr2_insertList = new List <string[]>(); List <string[]> arr2_updateValList = new List <string[]>(); List <string> arr_updateIdLIst = new List <string>(); List <string> arr_dropList = new List <string>(); string str_colMainID = ""; for (int i = 0; i < Items.Count; i++) { str_colMainID = Items[i].ColMainId.ToString(); switch (Items[i].Status) { case "1": if (string.IsNullOrEmpty(Items[i].ColDetailId.ToString()) || Items[i].ColDetailId.ToString() == "0") { string[] arr_insertList = { str_colMainID, Items[i].ColDetailName.ConvertSqlCondition(), Items[i].Desciption.ConvertSqlCondition() }; arr2_insertList.Add(arr_insertList); } else { string[] arr_updateValList = { Items[i].ColDetailName.ConvertSqlCondition(), Items[i].Desciption.ConvertSqlCondition() }; arr2_updateValList.Add(arr_updateValList); arr_updateIdLIst.Add(Items[i].ColDetailId.ToString()); } break; case "-1": if (!string.IsNullOrEmpty(Items[i].ColDetailId.ToString()) && Items[i].ColDetailId.ToString() != "0") { arr_dropList.Add(Items[i].ColDetailId.ToString()); } break; default: break; } } _ICon.InsertSchedulColumnDetail(out str_msg, arr2_insertList); _ICon.UpdateSchedulColumnDetail(out str_msg, arr2_updateValList, arr_updateIdLIst.ToArray()); _ICon.DropSchedulColumnDetail(out str_msg, "0", arr_dropList.ToArray()); List <SchedulColumnDetailModel> _schedulColumnDetailModels = _GetData.GetSchedulColumnDetail(out str_msg, str_colMainID); ViewBag.DetailData = _schedulColumnDetailModels; } else { ViewBag.DetailData = null; } } else { ViewBag.DetailData = null; } PartialViewResult x = PartialView("/Views/SchedulItem/Items.cshtml"); return(x); }