Пример #1
0
        public ActionResult List(int id, int seasonId, int?unionId)
        {
            var vm = new TeamForm
            {
                LeagueId  = id,
                SeasonId  = seasonId,
                UnionId   = unionId,
                SectionId = leagueRepo.GetById(id).Union.SectionId
            };

            if (User.IsInAnyRole(AppRole.Workers))
            {
                switch (usersRepo.GetTopLevelJob(base.AdminId))
                {
                case JobRole.UnionManager:
                    // vm.TeamsList = _teamsRepo.GetTeamsByLeague(id);
                    vm.TeamsList = teamRepo.GetTeams(seasonId, id);
                    break;

                case JobRole.LeagueManager:
                    vm.TeamsList = teamRepo.GetTeams(seasonId, id);
                    break;

                case JobRole.TeamManager:
                    vm.TeamsList = teamRepo.GetByManagerId(base.AdminId, seasonId);
                    break;
                }
            }
            else
            {
                vm.TeamsList = teamRepo.GetTeams(seasonId, id);
            }
            return(PartialView("_List", vm));
        }
Пример #2
0
        private void timToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form newform = new TeamForm();

            this.Hide();
            newform.Show();
        }
Пример #3
0
        private void CancelButton_Click(object sender, EventArgs e)
        {
            Form newform = new TeamForm();

            this.Hide();
            this.Close();
            newform.Show();
        }
Пример #4
0
        public void TeamLineUpIsPresented()
        {
            HomeForm homeForm = new HomeForm();

            Assert.AreEqual(homeForm.IsHomeFormTitleDisplayed, true);
            homeForm.Header.GoToSection("teams");
            TeamsForm teams = new TeamsForm();

            teams.GoToTeam(1);
            TeamForm teamForm = new TeamForm();

            Assert.AreEqual(teamForm.IsTeamLineupPresented(), true);
        }
Пример #5
0
        public void TeamProfileRedirecting()
        {
            HomeForm home = new HomeForm();

            Assert.AreEqual("2018 FIFA World Cup Russia™".ToLower(), home.Header.GetTitleText.ToLower());
            home.Header.GoToSection("teams");
            TeamsForm teams = new TeamsForm();

            Assert.AreEqual(32, teams.TeamsNumber);
            Assert.AreEqual("Teams".ToLower(), teams.Title.ToLower());
            TeamForm        selectedTeam = teams.GoToTeam(new Random().Next(31));
            string          teamName     = selectedTeam.Title;
            TeamProfileForm teamProfile  = selectedTeam.GoToTeamProfile();

            Assert.AreEqual(teamName, teamProfile.TeamName);
            Assert.IsTrue(teamProfile.TeamNameIsDisplayed);
            Assert.IsTrue(Browser.Url.Contains(teamName.ToLower()));
        }
Пример #6
0
        public ActionResult Create(TeamForm frm)
        {
            var team = new Team();

            if (frm.IsNew)
            {
                team.Title = frm.Title.Trim();

                // TODO: Update the LeagueTeams with correct SeasonId
                //team.SeasonId = frm.SeasonId;
                teamRepo.Create(team);
                teamRepo.AddTeamDetailToSeason(team, frm.SeasonId);
            }
            else if (frm.TeamId != 0 && !frm.IsNew)
            {
                team = teamRepo.GetById(frm.TeamId);
            }
            else
            {
                TempData["ErrExists"] = Messages.TeamNotFound;
                return(RedirectToAction("List", new { id = frm.LeagueId, seasonId = frm.SeasonId }));
            }

            var league           = teamRepo.GetLeague(frm.LeagueId);
            var isExistsInLeague = league.LeagueTeams.Any(t => t.TeamId == team.TeamId);

            if (!isExistsInLeague)
            {
                var lt = new LeagueTeams
                {
                    TeamId   = team.TeamId,
                    LeagueId = league.LeagueId,
                    SeasonId = frm.SeasonId
                };
                league.LeagueTeams.Add(lt);
                teamRepo.Save();
            }
            else
            {
                TempData["ErrExists"] = Messages.TeamExists;
            }

            return(RedirectToAction("List", new { id = frm.LeagueId, seasonId = frm.SeasonId }));
        }
Пример #7
0
 public void ManOfTheMatch()
 {
     try
     {
         HomeForm home = new HomeForm();
         Assert.AreEqual("2018 FIFA World Cup Russia™".ToLower(), home.Header.GetTitleText.ToLower());
         home.Header.GoToSection("teams");
         TeamsForm teams = new TeamsForm();
         Assert.AreEqual(32, teams.TeamsNumber);
         Assert.AreEqual("Teams".ToLower(), teams.Title.ToLower());
         TeamForm  selectedTeam = teams.GoToTeam((new Random()).Next(teams.TeamsNumber - 1));
         MatchForm match        = selectedTeam.GoToMatch((new Random()).Next(selectedTeam.Matches.Count - 1));
         match.GoToManOfTheMatchPage();
         Assert.IsTrue(match.ManOfTheMatch.Displayed);
     }
     catch
     {
         ScreenshotTaker screenshotmaker = new ScreenshotTaker();
         screenshotmaker.MakeScreen();
         screenshotmaker.PrintScreenshotsTo();
     }
 }
Пример #8
0
        private void ShowTeamForm(Team team, bool modal)
        {
            TeamForm form = new TeamForm(team);

            if (modal == true)
            {
                form.ShowDialog();
            }
            else
            {
                form.Show();
            }
        }
Пример #9
0
        private void ShowTeamForm(string abbrev, bool modal)
        {
            Team team = league.GetTeamByAbbrev(abbrev);

            if (team == null)
            {
                MessageBox.Show("Invalid team");
                return;
            }

            TeamForm form = new TeamForm(team);

            if (modal == true)
            {
                form.ShowDialog();
            }
            else
            {
                form.Show();
            }
        }
Пример #10
0
        public ActionResult RegisterTeams(int id)
        {
            TeamForm form = new TeamForm(id);

            return(PartialView(form));
        }
Пример #11
0
        public async Task <IActionResult> Update([FromRoute] Guid id, [FromBody] TeamForm form, CancellationToken ct)
        {
            var updatedTeam = await _teamService.UpdateAsync(id, form, ct);

            return(Ok(updatedTeam));
        }
Пример #12
0
        public async Task <IActionResult> Create([FromRoute] Guid id, [FromBody] TeamForm form, CancellationToken ct)
        {
            var createdTeam = await _teamService.CreateAsync(id, form, ct);

            return(CreatedAtAction(nameof(this.Get), new { id = createdTeam.Id }, createdTeam));
        }