コード例 #1
0
        public ActionResult Create([Bind(Include = "CardID,CardName,CardTypeID,CardNumberID,CardPassword,create_at,update_at,CardNumber")] YGOSpells yGOSpells)
        {
            if (ModelState.IsValid)
            {
                db.YGOSpells.Add(yGOSpells);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CardNumberID = new SelectList(db.refCardList, "ID", "code", yGOSpells.CardNumberID);
            ViewBag.CardTypeID   = new SelectList(db.TypeSpellCard, "ID", "cardtype", yGOSpells.CardTypeID);
            return(View(yGOSpells));
        }
コード例 #2
0
        public ActionResult Create([Bind(Include = "CardID,CardName,CardAttributeID,CardLevel,MonsterTypeID,CardTypeID,ATK,DEF,CardNumberID,CardPassword,CardExtra,create_at,update_at,CardNumber")] YGOMonsters yGOMonsters)
        {
            if (ModelState.IsValid)
            {
                db.YGOMonsters.Add(yGOMonsters);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CardAttributeID = new SelectList(db.refAttribute, "ID", "attribute", yGOMonsters.CardAttributeID);
            ViewBag.CardNumberID    = new SelectList(db.refCardList, "ID", "code", yGOMonsters.CardNumberID);
            ViewBag.MonsterTypeID   = new SelectList(db.refMonsterType, "ID", "Attribute", yGOMonsters.MonsterTypeID);
            ViewBag.CardTypeID      = new SelectList(db.TypeMonsterCard, "ID", "cardtype", yGOMonsters.CardTypeID);
            return(View(yGOMonsters));
        }