public ActionResult UpdateLocation(string NoID, string EditLocationCodeId, string EditLocationNameId, string EditSiteCode, int ActiveId) { try { dc = new DCAssetDataContext(); try { var query = dc.MsLocation_IUD(EditLocationCodeId, EditLocationNameId, EditSiteCode, ActiveId, UserId, 2); string status = ""; foreach (var res in query) { status = res.Status; } if (status.Trim().Substring(0, 4) == "Err ") { return(Json(new { success = false, responseText = status.Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = true, responseText = status.Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new { success = false, responseText = ex.ToString().Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new { success = false, responseText = ex.Message.ToString().Trim().Replace("err ", "") }, JsonRequestBehavior.AllowGet)); } }