Beispiel #1
0
        public ActionResult Index()
        {
            ViewData["Message"] = "Welcome to the C# Assignment Framework";
            //Get the enrollments for the active user
            Team team = SessionUtil.GetTeamFromFormsAuthentication();

            if (team != null)
            {
                List<AssignmentEnrollment> enrollmentList = ClientFacade.Instance.GetAssignmentEnrollmentsForTeam(team.Id);

                team = ClientFacade.Instance.GetTeamById(team.Id);

                // Set up the model
                var hm = new HomeModel
                {
                    TeamName = team.Name,
                    MembersModel = new MembersModel {Members = team.Members},
                    EnrollmentList = new List<EnrollmentModel>()
                };

                foreach (AssignmentEnrollment ae in enrollmentList)
                {
                    hm.EnrollmentList.Add(new EnrollmentModel
                    {
                        AssignmentEnrollmentId = ae.Id,
                        AssignmentName = ae.TournamentAssignment.Assignment.Name,
                        TournamentName = ae.TournamentAssignment.Tournament.Name
                    });
                }

                return View(hm);
            }
            return View();
        }
Beispiel #2
0
        public ActionResult UpdateTeamMembers(HomeModel model)
        {
            Team team = SessionUtil.GetTeamFromFormsAuthentication();

            team = ClientFacade.Instance.GetTeamById(team.Id);

            team.Members = model.MembersModel.Members;

            ClientFacade.Instance.UpdateTeam(team);

            return RedirectToAction("Index");
        }