Exemple #1
0
        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 }));
            }
        }
Exemple #2
0
 public ActionResult Edit([Bind(Include = "Route_ID,Departure,Destination,Date,Airplane_ID")] Route route)
 {
     if (ModelState.IsValid)
     {
         db.Entry(route).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Airplane_ID = new SelectList(db.Airplane, "Airplane_ID", "Plane_Type", route.Airplane_ID);
     return(View(route));
 }
Exemple #3
0
        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 }));
            }
        }
Exemple #4
0
        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 }));
            }
        }