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; }
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 }; } }
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 }); } }
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; }
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 }; } }
public static object UpdateExam(StudentExam record) { return DemoMethods.UpdateExam(record); }