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));
        }
 public ActionResult Create(LadderWeek ladderweek)
 {
     if (ModelState.IsValid)
     {
         ladderweekRepository.InsertOrUpdate(ladderweek);
         ladderweekRepository.Save();
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View());
     }
 }