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)); }
// 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)); }