public ActionResult Create([Bind(Include = "ID,Symbol,Name,QuantityAvailable,MarketPrice")] StockData stockData)
        {
            if (ModelState.IsValid)
            {
                db.StockDatas.Add(stockData);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(stockData));
        }
示例#2
0
        public ActionResult Create([Bind(Include = "UserId,UserName,Password,Name,CreateDate")] User user)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(user));
        }
        public ActionResult Create([Bind(Include = "TransactionID,BlockID,TraderID,Symbol,QtyRequested,QtyAllocated,Type,Side,StatusID,TimeStamp")] Transaction transaction)
        {
            if (ModelState.IsValid)
            {
                db.Transactions.Add(transaction);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.StatusID = new SelectList(db.Status, "StatusID", "StatusName", transaction.StatusID);
            ViewBag.Symbol   = new SelectList(db.StockDatas, "Symbol", "Name", transaction.Symbol);
            return(View(transaction));
        }