示例#1
0
        public ActionResult Create([Bind(Include = "Id,Name,Email,Gender,City,GameScore,DateOfBirth")] Gamer gamer)
        {
            if (ModelState.IsValid)
            {
                db.Gamers.Add(gamer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(gamer));
        }
示例#2
0
        private void SeedInMemoryStore()
        {
            MapperHelper.InitMapperConf();
            using (var context = new OnlineGameContext(_options))
            {
                context.Database.EnsureCreated();
                context.Games.AddRange(GamesTestData.FirstGame, GamesTestData.ThirdGame,
                                       GamesTestData.FourthGame);

                context.SaveChanges();
            }
        }