Esempio n. 1
0
        // GET: CourseMains/Details/5
        public ActionResult Details(int id)
        {
            CourseMain courseMain = db.CourseMains.Find(id);

            if (courseMain == null)
            {
                return(HttpNotFound());
            }

            // Get Course Details (Card of Course)
            var CourseDetail = from cd in db.CourseDetails
                               where cd.CourseID == id
                               select cd;

            ViewBag.ClubName = courseMain.ClubName;

            // Get 9 Holes Total and Store in ViewBag variables
            // Front 9
            ViewBag.FrontWhiteYrds  = cInfo.GetCourseTotal(1, 9, id, "WhiteYrds");
            ViewBag.FrontYellowYrds = cInfo.GetCourseTotal(1, 9, id, "YellowYrds");
            ViewBag.FrontMensPar    = cInfo.GetCourseTotal(1, 9, id, "MensPar");
            ViewBag.FrontRedYrds    = cInfo.GetCourseTotal(1, 9, id, "RedYrds");
            ViewBag.FrontLadiesPar  = cInfo.GetCourseTotal(1, 9, id, "LadiesPar");

            //Back 9
            ViewBag.BackWhiteYrds  = cInfo.GetCourseTotal(10, 18, id, "WhiteYrds");
            ViewBag.BackYellowYrds = cInfo.GetCourseTotal(10, 18, id, "YellowYrds");
            ViewBag.BackMensPar    = cInfo.GetCourseTotal(10, 18, id, "MensPar");
            ViewBag.BackRedYrds    = cInfo.GetCourseTotal(10, 18, id, "RedYrds");
            ViewBag.BackLadiesPar  = cInfo.GetCourseTotal(10, 18, id, "LadiesPar");

            // Totals
            ViewBag.TotalWhiteYrds  = Convert.ToInt32(ViewBag.FrontWhiteYrds + Convert.ToInt32(ViewBag.BackWhiteYrds));
            ViewBag.TotalYellowYrds = Convert.ToInt32(ViewBag.FrontYellowYrds + Convert.ToInt32(ViewBag.BackYellowYrds));
            ViewBag.TotalMensPar    = Convert.ToInt32(ViewBag.FrontMensPar + Convert.ToInt32(ViewBag.BackMensPar));
            ViewBag.TotalRedYrds    = Convert.ToInt32(ViewBag.FrontRedYrds + Convert.ToInt32(ViewBag.BackRedYrds));
            ViewBag.TotalLadiesPar  = Convert.ToInt32(ViewBag.FrontLadiesPar + Convert.ToInt32(ViewBag.BackLadiesPar));

            return(View(CourseDetail.ToList()));
        }