Example #1
0
        public ActionResult Evaluation([Bind(Include = " EffectiveTeaching, ProvidesFeedback, learningClimate,DemonstrateKnowlege,professionalism,overAllRanking ")] Evaluation.Models.Evaluation eval)
        {
            Teacher teacher = TempData["teacher"] as Teacher;
            Student student = TempData["std"] as Student;

            eval.TeacherID = teacher.TeacherID;
            eval.StudentID = student.StudentID;
            try
            {
                if (ModelState.IsValid)
                {
                    db.Evaluations.Add(eval);
                    db.SaveChanges();
                    return(View("Submitted"));
                }
            }
            catch (DataException /* dex */)
            {
                //Log the error (uncomment dex variable name and add a line here to write a log.
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
            }
            return(View(eval));
        }
        // GET: Evaluations
        // Show a teacher's evaluation results
        public ActionResult Details(string teachername, int?std, string graded)
        {
            if (graded != "yes")
            {
                return(View("Unauthorized"));
            }
            if (teachername == null && std == null)
            {
                return(View("Error"));
            }

            // request a complete evaluation form based on teacherID
            Teacher teacher = db.Teachers.Where(x => x.Name == teachername).FirstOrDefault();
            Student student = db.Students.Where(x => x.StudentID == std).FirstOrDefault();

            Evaluation.Models.Evaluation eval = db.Evaluations.Where(x => x.TeacherID == teacher.TeacherID && x.StudentID == std).FirstOrDefault();
            eval.Teacher = teacher;
            eval.Student = student;
            if (eval == null)
            {
                return(View("Error"));
            }
            return(View(eval));
        }