Example #1
0
        public async Task <ActionResult> CreatePlayer(Player player)
        {
            if (ModelState.IsValid)
            {
                context.Add(player);
                await context.SaveChangesAsync();

                TempData["Success"] = player.Name + " has been added";

                return(RedirectToAction("Index"));
            }
            return(View(player));
        }
Example #2
0
        public async Task <ActionResult> CreateTeam(Team team)
        {
            if (ModelState.IsValid)
            {
                context.Add(team);
                await context.SaveChangesAsync();

                TempData["Success"] = team.Name + " has been added";

                return(RedirectToAction("Index"));
            }
            return(View(team));
        }