コード例 #1
0
        public ActionResult Create([Bind(Include = "GOODSID,STOCK")] STOCKTBL sTOCKTBL)
        {
            if (ModelState.IsValid)
            {
                db.STOCKTBL.Add(sTOCKTBL);

                sTOCKTBL.DEALID = (from goods in db.GOODSTBL
                                   where goods.GOODSID == sTOCKTBL.GOODSID
                                   select goods.GOODSID).Single();

                sTOCKTBL.GOODSNM = (from goods in db.GOODSTBL
                                    where goods.GOODSID == sTOCKTBL.GOODSID
                                    select goods.GOODSNM).Single();

                sTOCKTBL.PRICE = (from goods in db.GOODSTBL
                                  where goods.GOODSID == sTOCKTBL.GOODSID
                                  select goods.PRICE).Single();

                sTOCKTBL.TPRICE = sTOCKTBL.PRICE * sTOCKTBL.STOCK;

                sTOCKTBL.LASTUDT = DateTime.Now;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sTOCKTBL));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(string id)
        {
            STOCKTBL sTOCKTBL = db.STOCKTBL.Find(id);

            db.STOCKTBL.Remove(sTOCKTBL);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
        // GET: STOCKTBLs/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            STOCKTBL sTOCKTBL = db.STOCKTBL.Find(id);

            if (sTOCKTBL == null)
            {
                return(HttpNotFound());
            }
            return(View(sTOCKTBL));
        }