예제 #1
0
        public void UpdateExam(StudentExam exam)
        {
            var foundExam = _dataSource.StudentExams.FirstOrDefault(e => e.StudentExamId == exam.StudentExamId);
            if (foundExam == null)
            {
                return;
            }

            foundExam.CourseName = exam.CourseName;
            foundExam.Degree = exam.Degree;
            foundExam.ExamDate = exam.ExamDate;
        }
예제 #2
0
 public static object CreateExam(StudentExam exam)
 {
     try
     {
         var addedExam = _repository.ExamRepository.AddExam(exam);
         return new { Result = "OK", Record = addedExam };
     }
     catch (Exception ex)
     {
         return new { Result = "ERROR", Message = ex.Message };
     }
 }
예제 #3
0
        public JsonResult CreateExam(StudentExam exam)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return Json(new { Result = "ERROR", Message = "Form is not valid! Please correct it and try again." });
                }

                var addedExam = _repository.ExamRepository.AddExam(exam);
                return Json(new { Result = "OK", Record = addedExam });
            }
            catch (Exception ex)
            {
                return Json(new { Result = "ERROR", Message = ex.Message });
            }
        }
예제 #4
0
 public StudentExam AddExam(StudentExam exam)
 {
     exam.StudentExamId = _dataSource.StudentExams.Count > 0 ? (_dataSource.StudentExams[_dataSource.StudentExams.Count - 1].StudentExamId + 1) : 1;
     _dataSource.StudentExams.Add(exam);
     return exam;
 }
예제 #5
0
 public static object UpdateExam(StudentExam exam)
 {
     try
     {
         _repository.ExamRepository.UpdateExam(exam);
         return new { Result = "OK" };
     }
     catch (Exception ex)
     {
         return new { Result = "ERROR", Message = ex.Message };
     }
 }
예제 #6
0
 public static object UpdateExam(StudentExam record)
 {
     return DemoMethods.UpdateExam(record);
 }