Example #1
0
        public ActionResult AddTeam()
        {
            /* This method will add a new team to the DB */
            var someTeam = new TeamModel();

            return View(someTeam);
        }
Example #2
0
        public ActionResult AddTeam(TeamModel team)
        {
            Team newTeam = new Team
            {
                teamId = team.teamId,
                teamName = team.teamName,
                location = team.baseLocation,
                championshipsWon = team.championshipsWon,
                teamLogo = team.teamLogo,
                championshipPoints = team.championshipPoints
            };

            db.Teams.InsertOnSubmit(newTeam);
            db.SubmitChanges();

            return Redirect("/");
        }
Example #3
0
        public ActionResult EditTeam(FormCollection collection)
        {
            string teamName = collection["lstTeams"];

            var teams = (from t in db.Teams
                        where t.teamId == teamName
                        select t).Single();

            var model = new TeamModel()
            {
                teamId = teams.teamId,
                teamName = teams.teamName,
                teamLogo = teams.teamLogo,
                baseLocation = teams.location,
                championshipsWon = teams.championshipsWon,
                 championshipPoints = Convert.ToInt32(teams.championshipPoints)
            };

            return View(model);
        }