Esempio n. 1
0
        public ActionResult Create(AccountOfferCreate offer)
        {
            if (ModelState.IsValid)
            {
                var svc = CreateAccountOfferService();
                svc.CreateAccountOffer(offer);
                return(RedirectToAction("Index"));
            }

            ViewBag.GameID = new SelectList(db.Games, "ID", "Name", offer.GameId);
            return(View(offer));
        }
Esempio n. 2
0
        // GET: AccountOffers/Create
        public ActionResult Create()
        {
            var games    = db.Games.ToList();
            var gameList = new SelectList(games.Select(e => new SelectListItem()
            {
                Value = e.ID.ToString(),
                Text  = e.Name
            }).ToList(), "Value", "Text");

            var model = new AccountOfferCreate()
            {
                ListOfGames = gameList
            };

            return(View(model));
        }