public IHttpActionResult DeleteTableKucun(string goodsName) { testEntities1 testEntities1Obj = new testEntities1(); testEntities1Obj.Configuration.ProxyCreationEnabled = false; List <kucun> list = testEntities1Obj.kucun.ToList(); kucun obj1 = testEntities1Obj.kucun.Find(goodsName); //kucun obj = new kucun() //{ // 商品名称 = data //}; testEntities1Obj.Entry <kucun>(obj1).State = EntityState.Deleted; int res = testEntities1Obj.SaveChanges(); if (res > 0) { return(Json(new { action = true })); } else { return(Json(new { action = false })); } }
public IHttpActionResult UpdateTableKucun1(string goodsName, int goodsNum) { testEntities1 testEntities1Obj = new testEntities1(); testEntities1Obj.Configuration.ProxyCreationEnabled = false; List <kucun> list = testEntities1Obj.kucun.ToList(); kucun obj1 = testEntities1Obj.kucun.Find(goodsName); obj1.数量 = goodsNum; //string[] data = new string[2]; //kucun obj = new kucun() //{ // 商品名称 = goodsName, // 数量 = goodsNum //}; //testEntities1Obj.Entry<kucun>(obj).State = EntityState.Modified; int res = testEntities1Obj.SaveChanges(); if (res > 0) { return(Json(new { action = true })); } else { return(Json(new { action = false })); } }
public JsonResult DeleteTableKucun(string data) { kucun obj = new kucun() { 商品名称 = data, }; testEntities1 testentities1obj = new testEntities1(); testentities1obj.Entry <kucun>(obj).State = EntityState.Deleted; int res = testentities1obj.SaveChanges(); if (res > 0) { return(Json(new { action = true })); } else { return(Json(new { action = false })); } }
public IHttpActionResult InsertinTableKucun(string goodsName, int goodsNum) { kucun obj = new kucun() { 商品名称 = goodsName, 数量 = goodsNum }; testEntities1 testEntities1Obj = new testEntities1(); testEntities1Obj.kucun.Add(obj); int res = testEntities1Obj.SaveChanges(); if (res > 0) { return(Json(new { action = true })); } else { return(Json(new { action = false })); } }
public JsonResult InsertinTableKucun(string[] data) { kucun obj = new kucun() { 商品名称 = data[0], 数量 = int.Parse(data[1]) }; testEntities1 testEntities1Obj = new testEntities1(); testEntities1Obj.kucun.Add(obj); int res = testEntities1Obj.SaveChanges(); if (res > 0) { return(Json(new { action = true })); } else { return(Json(new { action = false })); } }
public JsonResult UpdateTableKucun(string[] data) { kucun obj = new kucun() { 商品名称 = data[0], 数量 = int.Parse(data[1]) }; testEntities1 testentities1obj = new testEntities1(); testentities1obj.Entry <kucun>(obj).State = EntityState.Modified; int res = testentities1obj.SaveChanges(); if (res > 0) { return(Json(new { action = true })); } else { return(Json(new { action = false })); } }