public JsonResult Edit(Nomenclator Parte) { response toReturn = new response(); string conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString; int uid = Convert.ToInt32(Session["CURENT_USER_ID"]); Nomenclator i = null; if (Parte != null) { i = new Nomenclator(uid, conStr, "parti"); PropertyInfo[] pis = Parte.GetType().GetProperties(); foreach (PropertyInfo pi in pis) { pi.SetValue(i, pi.GetValue(Parte)); } } i.TableName = "parti"; if (i.ID == null) // insert { toReturn = i.Insert(); } else //update { toReturn = i.Update(); } return(Json(toReturn, JsonRequestBehavior.AllowGet)); }
public JsonResult Edit(Nomenclator TipProces) { response toReturn = new response(); string conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString; int uid = Convert.ToInt32(Session["CURENT_USER_ID"]); Nomenclator tp = null; if (TipProces != null) { tp = new Nomenclator(uid, conStr, "tip_procese"); PropertyInfo[] pis = TipProces.GetType().GetProperties(); foreach (PropertyInfo pi in pis) { pi.SetValue(tp, pi.GetValue(TipProces)); } } tp.TableName = "tip_procese"; if (tp.ID == null) // insert { toReturn = tp.Insert(); } else //update { toReturn = tp.Update(); } return(Json(toReturn, JsonRequestBehavior.AllowGet)); }