Example #1
0
        public ActionResult SetupRound(int holeId)
        {
            var teeId   = Convert.ToInt32(TempData["teeId"]);
            var tees    = _context.TeeModels.FirstOrDefault(c => c.Id == teeId);
            var course  = tees.CourseModelId;
            var holePar = _context.HoleModels.FirstOrDefault(c => c.Id == holeId).HolePar;

            var roundModel = new RoundModel
            {
                CourseModelId = course,
                TeeModelId    = teeId,
                HoleModelId   = holeId,
            };

            var viewModel = new NewRoundViewModel
            {
                HoleModels = _context.HoleModels.Where(c => c.TeeModelId == teeId),
                RoundModel = roundModel,
            };

            TempData["courseId"]  = course;
            TempData["teeId"]     = teeId;
            TempData["holeId"]    = holeId;
            TempData["holeCount"] = 1;

            if (holePar == 3)
            {
                return(RedirectToAction("Green", "NewRound"));
            }

            return(RedirectToAction("Fairway", "NewRound"));
        }
Example #2
0
        //***********************************************************
        //*                     FAIRWAY                             *
        //***********************************************************

        public ActionResult Fairway()
        {
            var holeCount = Convert.ToInt32(TempData["holeCount"]);

            TempData["holeCount"] = holeCount;

            var courseId = Convert.ToInt32(TempData["courseId"]);

            TempData["courseId"] = courseId;

            var teeId = Convert.ToInt32(TempData["teeId"]);

            TempData["teeId"] = teeId;

            var holeId = Convert.ToInt32(TempData["holeId"]);

            TempData["holeId"] = holeId;

            var roundModel = new RoundModel
            {
                CourseModelId = courseId,
                TeeModelId    = teeId,
                HoleModelId   = holeId,
            };

            var viewModel = new NewRoundViewModel
            {
                HoleModels = _context.HoleModels.Where(c => c.Id == roundModel.HoleModelId),
                RoundModel = roundModel,
            };

            return(View(viewModel));
        }
Example #3
0
        public ActionResult ChooseTees(int courseId)
        {
            var tees      = _context.TeeModels.Where(c => c.CourseModelId == courseId);
            var viewModel = new NewRoundViewModel
            {
                TeeModels = tees,
            };

            return(View(viewModel));
        }
Example #4
0
        //***********************************************************
        //*                     SETUP                               *
        //***********************************************************

        public ActionResult ChooseCourse()
        {
            var courses   = _context.CourseModels.ToList();
            var viewModel = new NewRoundViewModel
            {
                CourseModels = courses,
            };

            return(View(viewModel));
        }
Example #5
0
        public ActionResult ChooseStartingHole(int teeId)
        {
            var holes     = _context.HoleModels.Where(c => c.TeeModelId == teeId);
            var viewModel = new NewRoundViewModel
            {
                HoleModels = holes,
            };

            TempData["teeId"] = teeId;

            return(View(viewModel));
        }
Example #6
0
        //***********************************************************
        //*                     SCORE                               *
        //***********************************************************

        public ActionResult Score()
        {
            var holeCount = Convert.ToInt32(TempData["holeCount"]);

            TempData["holeCount"] = holeCount;

            var courseId = Convert.ToInt32(TempData["courseId"]);

            TempData["courseId"] = courseId;

            var teeId = Convert.ToInt32(TempData["teeId"]);

            TempData["teeId"] = teeId;

            var holeId = Convert.ToInt32(TempData["holeId"]);

            TempData["holeId"] = holeId;

            var fairway = Convert.ToInt32(TempData["fairway"]);

            TempData["fairway"] = fairway;

            var green = Convert.ToInt32(TempData["green"]);

            TempData["green"] = green;

            var putts = Convert.ToInt32(TempData["putts"]);

            TempData["putts"] = putts;

            var roundModel = new RoundModel
            {
                CourseModelId = courseId,
                TeeModelId    = teeId,
                HoleModelId   = holeId,
            };

            var viewModel = new NewRoundViewModel
            {
                HoleModels = _context.HoleModels.Where(c => c.Id == roundModel.HoleModelId),
                RoundModel = roundModel,
            };

            return(View(viewModel));
        }