Exemple #1
0
        public ActionResult Create([Bind(Include = "TeamId,TeamName,City,Province,PlayerId,country")] Team team)
        {
            if (ModelState.IsValid)
            {
                db.Teams.Add(team);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(team));
        }
Exemple #2
0
        public ActionResult Create([Bind(Include = "PlayerId,FirstName,LastName,Position")] Player player)
        {
            if (ModelState.IsValid)
            {
                db.Players.Add(player);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(player));
        }
Exemple #3
0
        public ActionResult Create([Bind(Include = "Id,Name,TeamId,PlayerId")] Country country)
        {
            if (ModelState.IsValid)
            {
                db.countries.Add(country);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(country));
        }
Exemple #4
0
        public ActionResult Create([Bind(Include = "PlayerId,FirstName,LastName,Position,TeamName")] Player player)
        {
            if (ModelState.IsValid)
            {
                db.Players.Add(player);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.TeamName = new SelectList(db.Teams, "TeamName", "City", player.TeamName);
            return(View(player));
        }
 public void Save()
 {
     context.SaveChanges();
 }