Exemple #1
0
        public void Test_Referencial_Entities_Are_Saved()
        {
            MapSeeding();
            var player = new Player()
            {
                Name       = "Ioann The Terrible",
                CurrentMap = _dbContext.Set <Map>().FirstOrDefault()
            };

            _dbContext.Add(player);
            _dbContext.SaveChanges();
            Assert.Pass();
        }
        public async Task <IActionResult> Create([Bind("playerId,playerName")] Player player)
        {
            if (ModelState.IsValid)
            {
                _context.Add(player);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(player));
        }