public ActionResult EditExam(int id)
        {
            ViewBag.CourseId = id;
            var exam      = ExamServiceCaller.Get(id);
            var examModel = new ExamEditViewModel()
            {
                CourseName = exam.CourseName,
                Difficulty = exam.Difficulty,
                ExamDay    = exam.Date,
                ExamRoom   = exam.Room,
                Hour       = exam.Hour
            };

            return(View(examModel));
        }
        public ActionResult EditExam(int id, ExamEditViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var exam = ExamServiceCaller.Get(id);

            if (!String.IsNullOrEmpty(model.CourseName))
            {
                exam.CourseName = model.CourseName;
            }
            if (model.ExamDay != null)
            {
                exam.Date = model.ExamDay ?? new DateTime();
            }
            if (!String.IsNullOrEmpty(model.Hour.ToString()))
            {
                exam.Hour = model.Hour ?? 0;
            }
            if (!String.IsNullOrEmpty(model.Difficulty.ToString()))
            {
                exam.Difficulty = model.Difficulty ?? 0;
            }
            if (!String.IsNullOrEmpty(model.ExamRoom))
            {
                exam.Room = model.ExamRoom;
            }
            try
            {
                ExamServiceCaller.Update(exam);
                return(RedirectToAction("Index", "Exam"));
            }
            catch (Exception ex)
            {
                return(View(ex.Message));
            }
        }