ITimeU.Controllers.TimeStartnumberController.Index C# (CSharp) Method

Index() private method

private Index ( int raceId ) : System.Web.Mvc.ActionResult
raceId int
return System.Web.Mvc.ActionResult
        public ActionResult Index(int raceId)
        {
            var race = RaceModel.GetById(raceId);

            TimerModel timer;
            if (race.GetTimerId().HasValue)
                timer = TimerModel.GetTimerById(race.GetTimerId().Value);
            else
            {
                timer = new TimerModel();
                timer.RaceID = raceId;
            }
            timer.SaveToDb();

            TimeStartnumberModel timeStartnumberModel;
            timeStartnumberModel = new TimeStartnumberModel(timer);
            var checkpointOrder = new CheckpointOrderModel();

            ViewBag.Checkpoints = CheckpointModel.GetCheckpoints(raceId);
            ViewBag.RaceId = raceId;
            ViewBag.RaceName = race.Name;
            timeStartnumberModel.ChangeCheckpoint(timer.GetFirstCheckpointId());
            timeStartnumberModel.CheckpointOrder = checkpointOrder;
            Session["TimeStartnumber"] = timeStartnumberModel;
            return View("Index", timeStartnumberModel);
        }