Beispiel #1
0
        public ActionResult AddMatchWeek(string id)
        {
            var model = new MatchWeek();

            model.LeagueID = id;
            model.StarDate = DateTime.Now;
            model.EndDate  = DateTime.Now;
            return(View(model));
        }
        private void listView_Click(object sender, SelectionChangedEventArgs e)
        {
            var currentMatchWeek = (KeyValuePair <int, MatchWeek>)e.AddedItems[0];

            _currentMatchWeek = currentMatchWeek.Value;
            var matches = currentMatchWeek.Value.MatchIds.Select(guid => _matchRepositoryService.FindById(guid));

            CurrentMatchWeekMatches.ItemsSource = matches;
        }
Beispiel #3
0
 public ActionResult AddMatchWeek(MatchWeek model)
 {
     if (ModelState.IsValid)
     {
         model.MatchWeekID = DateTime.Now.ToString("yyyyMMddHHmmss") + Guid.NewGuid();
         context.SaveAsync <MatchWeek>(model);
         return(RedirectToAction("MatchWeek", new { id = model.LeagueID }));
     }
     return(View(model));
 }
        public void AddMatchWeek(DateTime startDate, DateTime endDate, int weekNumber, int matchId)
        {
            var matchWeek = new MatchWeek()
            {
                StartDate  = startDate,
                EndDate    = endDate,
                WeekNumber = weekNumber,
                MatchId    = matchId
            };

            _db.MatchWeeks.Add(matchWeek);
        }
    MatchWeek[] GenerateWeeks(Team [] teams)
    {
        Team[] teamList = (Team[])teams.Clone();
        int    len      = teamList.Length;

        MatchWeek[] weeks = new MatchWeek[len - 1];
        for (int ii = 0; ii < len - 1; ii++)
        {
            weeks[ii] = new MatchWeek(teamList, ii + 1);
            ShuffleMatches(weeks[ii].matches);
            if (ii != len - 2)
            {
                DoOneCycle(teamList);
            }
        }

        return(weeks);
    }
Beispiel #6
0
        //Fixtures
        #region Fixtures & Results
        public ActionResult Fixtures(string id)
        {
            Fixtures  model     = new Fixtures();
            MatchWeek matchWeek = context.Load <MatchWeek>(id);

            model.matchWeek.Add(matchWeek.MatchWeekID, matchWeek);
            List <ScanCondition> condition = new List <ScanCondition>();

            condition.Add(new ScanCondition("MatchWeekID", ScanOperator.Equal, id));
            model.Index = context.Scan <Match>(condition.ToArray());
            condition   = new List <ScanCondition>();
            condition.Add(new ScanCondition("LeagueID", ScanOperator.Equal, id));
            model.Teams = context.Scan <Team>(condition.ToArray()).ToDictionary(a => a.TeamID, b => b);
            //var model= db.Matches.Include(m => m.MatchWeek).Where(m => m.MatchWeekID == id).AsEnumerable();
            //ViewBag.MatchWeekID = id;
            //int leagueId = db.MatchWeeks.Find(id).LeagueID;
            //ViewBag.Teams = db.Teams.Where(t => t.LeagueID == leagueId).ToDictionary(a => a.TeamID, b => b);
            ViewBag.allowAdd = true;
            return(View(model));
        }
Beispiel #7
0
        public MockDataAccess()
        {
            //Mock match
            Match match1 = new Match()
            {
                CreatedById = "scheller",
                Id          = 1,
                Info        = "Match 1 Info",
                MatchEnd    = new DateTime(2030, 12, 31),
                MatchStart  = new DateTime(2020, 01, 01),
                MatchName   = "Match 1"
            };

            //Mock matchweek
            MatchWeek match1Week1 = new MatchWeek()
            {
                Id         = 1,
                StartDate  = new DateTime(2020, 01, 01),
                EndDate    = new DateTime(2020, 01, 06),
                MatchId    = 1,
                WeekNumber = 1
            };

            MatchWeek match1Week2 = new MatchWeek()
            {
                Id         = 2,
                StartDate  = new DateTime(2020, 01, 07),
                EndDate    = new DateTime(2020, 01, 14),
                MatchId    = 1,
                WeekNumber = 2
            };

            //Mock CheckIns
            CheckIn checkIn1 = new CheckIn()
            {
                Id                = 1,
                CreatedDate       = new DateTime(2020, 01, 02),
                LastModifiedDate  = new DateTime(2020, 01, 02),
                CreatedById       = "player1",
                Weight            = 200,
                ApplicationUserId = "player1",
                MatchWeekId       = 1
            };

            CheckIn checkIn2 = new CheckIn()
            {
                Id                = 2,
                CreatedDate       = new DateTime(2020, 01, 08),
                LastModifiedDate  = new DateTime(2020, 01, 09),
                CreatedById       = "player1",
                Weight            = 199,
                ApplicationUserId = "player1",
                MatchWeekId       = 2
            };

            CheckIn checkIn3 = new CheckIn()
            {
                Id                = 3,
                CreatedDate       = new DateTime(2020, 01, 02),
                LastModifiedDate  = new DateTime(2020, 01, 02),
                CreatedById       = "player2",
                Weight            = 100,
                ApplicationUserId = "player2",
                MatchWeekId       = 1
            };

            CheckIn checkIn4 = new CheckIn()
            {
                Id                = 4,
                CreatedDate       = new DateTime(2020, 01, 08),
                LastModifiedDate  = new DateTime(2020, 01, 09),
                CreatedById       = "player2",
                Weight            = 110,
                ApplicationUserId = "player2",
                MatchWeekId       = 2
            };


            _allCheckIns.Add(checkIn1);
            _allCheckIns.Add(checkIn2);
            _allCheckIns.Add(checkIn3);
            _allCheckIns.Add(checkIn4);


            _allMatchWeeks.Add(match1Week1);
            _allMatchWeeks.Add(match1Week2);


            _allMatches.Add(match1);
        }