public ActionResult Detail(string id = "") { MD_SUBSELECTION model = new MD_SUBSELECTION(); if (!string.IsNullOrEmpty(id)) { var result = APIHelper.CallAPI <JsonResultObject <List <MD_SUBSELECTION> > >("subselection/getdetail", new { id = id }); if (result.IsOk) { model = result.dataObj.FirstOrDefault(); } } return(View(model)); }
public JsonResult Save(MD_SUBSELECTION info) { if (info.ID != 0) { if (string.IsNullOrEmpty(info.NAME)) { return(Json(new JsonResultData { IsOk = false, dataErr = null, dataObj = null, Msg = "NAME can not be null", totalrows = 0 }, JsonRequestBehavior.AllowGet)); } if (string.IsNullOrEmpty(info.SHORTNAME)) { return(Json(new JsonResultData { IsOk = false, dataErr = null, dataObj = null, Msg = "SHORTNAME can not be null", totalrows = 0 }, JsonRequestBehavior.AllowGet)); } //update return(Json(APIHelper.CallAPI <JsonResultData>("subselection/update", new { info.ID, info.SELECTIONID, info.NAME, info.SHORTNAME, info.VALUE }), JsonRequestBehavior.AllowGet)); } else { if (string.IsNullOrEmpty(info.NAME)) { return(Json(new JsonResultData { IsOk = false, dataErr = null, dataObj = null, Msg = "NAME can not be null", totalrows = 0 }, JsonRequestBehavior.AllowGet)); } if (string.IsNullOrEmpty(info.SHORTNAME)) { return(Json(new JsonResultData { IsOk = false, dataErr = null, dataObj = null, Msg = "SHORTNAME can not be null", totalrows = 0 }, JsonRequestBehavior.AllowGet)); } //insert return(Json(APIHelper.CallAPI <JsonResultData>("subselection/insert", new { info.ID, info.SELECTIONID, info.NAME, info.SHORTNAME, info.VALUE }), JsonRequestBehavior.AllowGet)); } }