コード例 #1
0
 public TeamInfoPage()
 {
     InitializeComponent();
     tivm             = new TeamInfoViewModel();
     this.DataContext = tivm;
     tivm.CurrentPage = this;
 }
コード例 #2
0
ファイル: TeamsController.cs プロジェクト: kumzy0/TME
        public IActionResult TeamInfo(Guid id)
        {
            var team       = _context.Teams.FirstOrDefault(x => x.Id == id);
            var members    = _context.Members.Where(x => x.TeamId == id).ToList();
            var assignment = _context.Assignments.Where(x => x.TeamId == id).Include(x => x.Mentor).ToList();

            TeamInfoViewModel tiVM = new TeamInfoViewModel();

            tiVM.Team        = team;
            tiVM.TeamMember  = members;
            tiVM.Assignments = assignment;

            return(View(tiVM));
        }
コード例 #3
0
        public ActionResult Index()
        {
            TeamInfoViewModel model = null;
            var user = Sixty.Helpers.AppContext.Instance.CurrentUser(User.Identity);

            if (user == null)
            {
                throw new Exception(TR.T("Ошибка доступа!"));
            }
            if (user.Team != null)
            {
                model = new TeamInfoViewModel(user.Team);
            }
            return(View(model));
        }
コード例 #4
0
        public async Task <IActionResult> TeamInfo()
        {
            var model = new TeamInfoViewModel();

            using (var context = await createSiteContext())
            {
                // Retrieving lists of the target web
                var team = await context.Team.GetAsync(t => t.DisplayName, t => t.Description,
                                                       t => t.Channels.QueryProperties(p => p.Id, p => p.DisplayName));

                model.DisplayName = team.DisplayName;
                model.Description = team.Description;
                model.Channels    = new List <ChannelViewModel>(from c in team.Channels.ToList()
                                                                select new ChannelViewModel
                {
                    DisplayName = c.DisplayName,
                    Id          = c.Id
                });
            }

            return(View("TeamInfo", model));
        }
コード例 #5
0
        internal static TeamInfoViewModel GetTeamInfo(Team team, int leagueId, int?seasonId = null)
        {
            if (!team.LeagueTeams.Any(l => l.LeagueId == leagueId))
            {
                return(null);
            }

            var vm = new TeamInfoViewModel();

            //teamId
            vm.TeamId = team.TeamId;

            //"place": 7,
            //"ratio": "2:3",
            //"succsessLevel": 59,
            LeagueRankService leagueRankService = new LeagueRankService(leagueId);
            RankLeague        rLeague           = leagueRankService.CreateLeagueRankTable(seasonId);

            if (rLeague != null)
            {
                var       stage = rLeague.Stages.OrderByDescending(t => t.Number).FirstOrDefault();
                RankGroup group;
                if (stage != null)
                {
                    group = stage.Groups.Where(gr => gr.Teams.Any(t => t.Id == team.TeamId)).FirstOrDefault();
                    RankTeam rTeam = null;
                    if (group != null)
                    {
                        rTeam = group.Teams.Where(t => t.Id == team.TeamId).FirstOrDefault();
                    }
                    if (rTeam != null)
                    {
                        vm.Place = int.Parse(rTeam.Position);
                        vm.Ratio = rTeam.SetsLost.ToString() + ":" + rTeam.SetsWon.ToString();
                        if (rTeam.Games == 0)
                        {
                            vm.SuccsessLevel = 0;
                        }
                        else
                        {
                            double wins  = rTeam.Wins;
                            double games = rTeam.Games;
                            double ratio = (wins / games) * 100;
                            vm.SuccsessLevel = Convert.ToInt32(ratio);
                        }
                    }
                }
            }
            vm.Logo     = team.Logo;
            vm.Image    = team.PersonnelPic;
            vm.League   = team.LeagueTeams.Where(tl => tl.LeagueId == leagueId).FirstOrDefault().Leagues.Name;
            vm.LeagueId = leagueId;

            if (seasonId.HasValue)
            {
                TeamsDetails teamsDetails = team.TeamsDetails.FirstOrDefault(x => x.SeasonId == seasonId);
                vm.Title = teamsDetails != null ? teamsDetails.TeamName : team.Title;
            }
            else
            {
                vm.Title = team.Title;
            }

            return(vm);
        }