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