protected void Button1_Click(object sender, EventArgs e) { if (hact.Value == "edit") { PaypalAccountType account = PaypalAccountType.findById(cvt.ToInt(hid.Value)); account.UserName = txtUserName.Value.Trim(); account.APIKEY = txtkey.Value.Trim(); account.APIPWD = txtPWD.Value.Trim(); account.ApiToken = txtAPIToKen.Value.Trim(); account.Description = txtDesc.Value.Trim(); account.AccountStatus = ckStatus.Checked ? "停用" : "正常"; account.update(); } else { PaypalAccountType account = new PaypalAccountType(); account.UserName = txtUserName.Value.Trim(); account.APIKEY = txtkey.Value.Trim(); account.APIPWD = txtPWD.Value.Trim(); account.ApiToken = txtAPIToKen.Value.Trim(); account.Description = txtDesc.Value.Trim(); account.AccountStatus = ckStatus.Checked ? "停用" : "正常"; account.insert(); } }
public ActionResult Edit(PaypalAccountType obj) { try { NSession.Update(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }
/// <summary> /// 根据Id获取 /// </summary> /// <param name="Id"></param> /// <returns></returns> public PaypalAccountType GetById(int Id) { PaypalAccountType obj = NSession.Get <PaypalAccountType>(Id); if (obj == null) { throw new Exception("返回实体为空"); } else { return(obj); } }
public JsonResult DeleteConfirmed(int id) { try { PaypalAccountType obj = GetById(id); NSession.Delete(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }
public ActionResult Edit(int id) { PaypalAccountType obj = GetById(id); return(View(obj)); }