public void LaunchNewSeason(SeasonOptions seasonOptions) { _startMoment = seasonOptions.StartDate; _startMoment = _startMoment.Add(seasonOptions.StartMomentTime); TimeSpan intervalBetweenRounds = new TimeSpan( seasonOptions.DaysBetweenRounds, seasonOptions.TimeBetweenRounds.Hours, seasonOptions.TimeBetweenRounds.Minutes, seasonOptions.TimeBetweenRounds.Seconds ); if (_startMoment < DateTime.Now) { throw new InvalidOperationException("Bad start time or date."); } _seasonService.Create(intervalBetweenRounds); _alarmClock.Rang += StartNewSeason; _alarmClock.Set(_startMoment); }
public virtual IActionResult Launch([FromForm] SeasonOptions seasonOptions) { _leagueService.LaunchNewSeason(seasonOptions); return(RedirectToAction(MVC.Home.Index())); }