Beispiel #1
0
        public ViewSeasonViewModel(Season season)
        {
            NumberOfWeeks = season.NumberOfWeeks;
            Weeks = new List<Week>();

            for (int i = 0; i < NumberOfWeeks; i++)
            {
                if (season.Weeks.ElementAtOrDefault(i) != null)
                    Weeks.Add(new Week(season.Weeks.ElementAt(i)));
            }

            NewWeek = new Week();
        }
Beispiel #2
0
        public ActionResult AddWeek(ViewSeasonViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var fixtures = Mapper.Map<IList<RealWorldFixture>>(vm.NewWeek.Fixtures);

                foreach (var fixture in fixtures)
                {
                    fixture.KickOff = DateTime.Now;
                }

                var addedWeek = _adminService.AddWeekToSeason(_seasonId, fixtures);

                var week = new Week(addedWeek);

                return PartialView("_ViewWeekPartial", week);
            }

            return null;
        }