Beispiel #1
0
        public ActionResult CreateNewWeek(int id)
        {
            var currentWeek  = repository.CurrentWeek();
            var newStandings = GetNewStandings(currentWeek.WeekNumber, id);

            var position = 1;

            foreach (var s in newStandings.OrderByDescending(g => g.TotalPoints))
            {
                s.Position = position;
                position++;
                standingRepository.InsertOrUpdate(s);
            }

            standingRepository.Save();

            currentWeek.IsCurrent = false;
            ladderWeekRepository.InsertOrUpdate(currentWeek);

            var nextWeek = ladderWeekRepository.GetById(id);

            nextWeek.IsCurrent = true;
            ladderWeekRepository.InsertOrUpdate(nextWeek);

            return(View("Edit", id));
        }
        //
        // GET: /LadderWeek/Details/5

        public ViewResult Details(int id)
        {
            return(View(ladderweekRepository.GetById(id)));
        }