Пример #1
0
        public ActionResult Admin(int groupid)
        {
            //var teams = unitOfWork.TeamRepository.GetTeamsByGroup(groupid).ToList();
            var group = unitOfWork.GroupRepository.GetByID(groupid);
            var allteams = unitOfWork.TeamRepository.Get(filter: t => t.Status == Status.Active).ToList();
            var teams = allteams.FindAll(t => t.CompTeams.Any(ct => ct.Competititon == groupid));
            List<Teams> availableTeams = null;
            if (group.Playoff == 1)
                availableTeams = allteams.FindAll(t => t.CompTeams.Any(ct => ct.Groups.Competitions.ID == group.Competitions.ID));
            else
                availableTeams = allteams.FindAll(t => t.CompTeams.All(ct => ct.Groups.Competitions.Status == Status.Inactive) || t.CompTeams == null && t.CompTeams.All(ct => ct.Competititon != groupid));

            TeamListViewModel model = new TeamListViewModel()
            {
                group = group,
                teams = teams,
                teams2join = availableTeams,
                fixtures = unitOfWork.FixtureRepository.Get(filter: f => f.Group == groupid).GroupBy(f => f.Round)
            };
            return View(model);
        }
        // GET: Fixture
        public ActionResult Index(int? groupid)
        {
            Groups group = unitOfWork.GroupRepository.GetByID((int)groupid);
            if  (group == null)
            {
                AddApplicationMessage("Skupina s tímto ID neexistuje", MessageSeverity.Danger);
                return RedirectToAction("Index", "Competitions");
            }

            var fixtures = unitOfWork.FixtureRepository.Get(filter: f => f.Group == groupid).GroupBy(f => f.Round);
            var model = new TeamListViewModel()
            {
                fixtures = fixtures,
                group = unitOfWork.GroupRepository.GetByID(groupid)
            };
            return View(model);
        }
Пример #3
0
 public ActionResult Index()
 {
     var model = new TeamListViewModel()
     {
         teams = unitOfWork.TeamRepository.GetTeams().ToList()
     };
     return View(model);
 }
Пример #4
0
 public ActionResult Group(int groupid)
 {
     TeamListViewModel model = new TeamListViewModel()
     {
         group = unitOfWork.GroupRepository.GetByID(groupid),
         //teams = unitOfWork.TeamRepository.GetTeamsByGroup(groupid).ToList(),
         table = unitOfWork.GroupTableRepository.Get(filter: gt => gt.ID==groupid).OrderBy(gt=>gt.Poradi).ToList(),
         fixtures = unitOfWork.FixtureRepository.Get(filter: f => f.Group == groupid).GroupBy(f => f.Round)
     };
     return View(model);
 }