Example #1
0
        // GET: BasicScheduler
        public ActionResult Index(int?id)
        {
            var course = db.Courses.FirstOrDefault(c => c.Id == id);


            var sched = new DHXScheduler(this);

            sched.Skin                = DHXScheduler.Skins.Terrace;
            sched.LoadData            = true;
            sched.EnableDataprocessor = true;
            sched.InitialDate         = course.StartDate;


            var ViewModel = new CourseDhxViewModel()
            {
                Course = course,
                DHX    = sched
            };


            var nrOfCourseIds = db.CurrentCourseID.Count();


            if (nrOfCourseIds > 0)
            {
                var CourseIdList = db.CurrentCourseID.Where(c => c.Compare == 1).ToList();

                foreach (var courseId in CourseIdList)
                {
                    db.CurrentCourseID.Remove(courseId);
                    db.SaveChanges();
                }
            }


            LatestCourseID.InputID(course.Id);

            db.CurrentCourseID.Add(LatestCourseID);

            db.SaveChanges();



            return(View(ViewModel));
        }