Ejemplo n.º 1
0
        //[HttpPost]
        //public ActionResult EditLineup(CUserTeamDetail model) {
        //// -----------------------------------------------------
        //// User has edited the lineups.
        //// So we must update the DB with the 4 lineup fields...
        //   var team = model.UserTeam;
        //   DbInfo.SetLineup(team.UserName, team.TeamName, model);

        //// And then return the EditTeam view...
        //   return View("EditTeam", new CUserTeamDetail(model.UserTeam.UserName, model.UserTeam.TeamName));
        //}


        public ActionResult SearchPlayers(string user, string team)
        {
            // -----------------------------------------------------
            var model = new CUserTeamSpecs()
            {
                UserName = user, TeamName = team
            };

            return(View(model));
        }
Ejemplo n.º 2
0
 public ActionResult AddTeam(CUserTeamSpecs team)
 {
     // ------------------------------------------
     try {
         ViewBag.Msg = "";
         if (team.TeamName == "" || team.TeamName == null)
         {
             ViewBag.Msg = "You must enter a team name";
         }
         else if (team.TeamName.Length > 30)
         {
             ViewBag.Msg = "Team name is too long (30 characters max)";
         }
         else
         {
             bool exists = info.TeamNameExists(team.UserName, team.TeamName);
             if (exists)
             {
                 ViewBag.Msg = "You already have a team named " + team.TeamName;
             }
         }
         if (ViewBag.Msg != "")
         {
             return(View(team));
         }
         else
         {
             info.AddNewTeam(team.UserName, team.TeamName, team.UsesDh);
             var view = new TeamListVM(team.UserName, info);
             return(View("TeamList", view));
         }
     }
     catch (Exception ex) {
         string msg =
             "An error occurred adding the new team to the database:\r\n" +
             ex.Message;
         ViewBag.ErrorMsg = msg;
         return(View("ErrorView"));
     }
 }