Example #1
0
        public ActionResult AssignTeam(Guid id) //PlayerID
        {
            CoachAssignTeamView   CoachAssignTeamView = new Models.ViewModels.CoachAssignTeamView();
            CoachAccessRepository coachRep            = new CoachAccessRepository();
            UserAccessRepository  userRep             = new UserAccessRepository();
            string currentUserName = System.Web.HttpContext.Current.User.Identity.Name;

            Guid coachID = userRep.GetPersonID(currentUserName);

            Person player = userRep.GetPerson(id);

            CoachAssignTeamView.PlayerName = player.FirstName + ", " + player.LastName;
            CoachAssignTeamView.PlayerID   = id;

            List <Team> teams = coachRep.GetTeams(coachID);

            CoachAssignTeamView.Teams = new List <SelectListItem>();
            foreach (Team team in teams)
            {
                CoachAssignTeamView.Teams.Add(new SelectListItem {
                    Text = team.Category + " - " + team.Name, Value = team.Id.ToString()
                });
            }

            return(View(CoachAssignTeamView));
        }
Example #2
0
        public ActionResult AssignPlayerBackToRegistrar(string id) //id = PlayerID
        {
            UserAccessRepository rep = new UserAccessRepository();
            Person player            = null;

            try
            {
                player = rep.GetPerson(Guid.Parse(id));

                CoachAccessRepository coachRep = new CoachAccessRepository();

                if (coachRep.AssignPlayerBackToRegistrar(Guid.Parse(id)))
                {
                    ViewData["Message"] = player.FirstName + ", " + player.LastName + " has been assigned back to registrar.";
                }
                else
                {
                    ViewData["Message"] = "There was an error processing your request. Please contact your administrator";
                }
            }
            catch (Exception e)
            {
                ViewData["Message"] = "There was an error processing your request. Please contact your administrator";
            }
            player = null;
            return(View(player));
        }
Example #3
0
        public ActionResult UnassignTeam(string id) //id = PlayerID
        {
            UserAccessRepository rep = new UserAccessRepository();
            Person player            = null;

            try
            {
                player = rep.GetPerson(Guid.Parse(id));
                CoachAccessRepository coachRep = new CoachAccessRepository();

                if (coachRep.UnassignTeamPlayer(Guid.Parse(id)))
                {
                    ViewData["Message"] = "Player was unassigned from team successfully.";
                }
                else
                {
                    ViewData["Message"] = "There was an error processing your request. Please contact your administrator.";
                }
            }
            catch
            {
                ViewData["Message"] = "There was an error processing your request. Please contact your administrator.";
            }

            player = null;
            return(View(player));
        }
Example #4
0
        public ActionResult AssignPlayerBackToRegistrar(Guid id) //id = PlayerID
        {
            UserAccessRepository rep = new UserAccessRepository();
            Person player            = rep.GetPerson(id);

            return(View(player));
        }
Example #5
0
        public ActionResult UnassignTeam(Guid id) //id = PlayerID
        {
            UserAccessRepository rep = new UserAccessRepository();
            Person player            = rep.GetPerson(id);

            return(View(player));
        }