public ActionResult InsertInfo(string CardNber, string Ccustodian, string StartCardNbumer, string EndCardNber, string CardNumber, string GrandTotalAmount)//新增卡号信息 { string strInfo = "falied"; try { //实例化对象 Models.S_MembershipCardInfoList myInfo = new Models.S_MembershipCardInfoList(); //给表对象属性赋值 myInfo.CardNber = CardNber.Trim(); myInfo.Ccustodian = Ccustodian.Trim(); myInfo.StartCardNbumer = StartCardNbumer.Trim(); myInfo.EndCardNber = EndCardNber.Trim(); myInfo.CardNumber = CardNumber.Trim(); myInfo.GrandTotalAmount = GrandTotalAmount.Trim(); //把表对象实体模型中 MyModels.S_MembershipCardInfoList.Add(myInfo); //将对象实体插入到数据库中 MyModels.SaveChanges(); strInfo = "ok"; } catch (Exception e) { Console.WriteLine(e); } return(Json(strInfo, JsonRequestBehavior.AllowGet)); }
public ActionResult InsertStore(string CardCode, string Ccustodian, string CredentialsNumber, string GrandTotalAmount, string Sum)//新增信息 { string strStore = "falied"; try { //实例化对象 Models.S_MembershipCardInfoList myStore = new Models.S_MembershipCardInfoList(); //给表对象属性赋值 myStore.CardCode = CardCode.Trim(); myStore.Ccustodian = Ccustodian.Trim(); myStore.CredentialsNumber = CredentialsNumber.Trim(); myStore.GrandTotalAmount = GrandTotalAmount.Trim(); myStore.Sum = Sum.Trim(); //把表对象实体模型中 MyModels.S_MembershipCardInfoList.Add(myStore); //将对象实体插入到数据库中 MyModels.SaveChanges(); strStore = "ok"; } catch (Exception e) { Console.WriteLine(e); } return(Json(strStore, JsonRequestBehavior.AllowGet)); }
public ActionResult DeleteMembershipCardInfo(int MembershipCardInfoId) //删除 { string strMsg = "fail"; //定义返回 //查询数据 Models.S_MembershipCardInfoList dbMemberAge = (from tbMembershipCardInfo in MyModels.S_MembershipCardInfoList where tbMembershipCardInfo.MembershipCardInfoID == MembershipCardInfoId select tbMembershipCardInfo).Single(); MyModels.S_MembershipCardInfoList.Remove(dbMemberAge);//删除 if (MyModels.SaveChanges() > 0) { strMsg = "success"; } return(Json(strMsg, JsonRequestBehavior.AllowGet)); }
public ActionResult InsertTGE(string StartCardNbumer, string EndCardNber, string CardNumber)//新增卡号信息 { string strTGE = "falied"; try { //实例化对象 Models.S_MembershipCardInfoList myTGE = new Models.S_MembershipCardInfoList(); //给表对象属性赋值 myTGE.StartCardNbumer = StartCardNbumer.Trim(); myTGE.EndCardNber = EndCardNber.Trim(); myTGE.CardNumber = CardNumber.Trim(); //把表对象实体模型中 MyModels.S_MembershipCardInfoList.Add(myTGE); //将对象实体插入到数据库中 MyModels.SaveChanges(); strTGE = "ok"; } catch (Exception e) { Console.WriteLine(e); } return(Json(strTGE, JsonRequestBehavior.AllowGet)); }