public JsonResult RecordAttendance(int studentId, int timeTableId) { try { var isPresent = _attendanceManager.IsStudentPresent(studentId, timeTableId); if (isPresent) { return(Json(new { result = "AlreadyPresent" }, JsonRequestBehavior.AllowGet)); } _attendanceManager.RecordAttendance(studentId, timeTableId); return(Json(new { result = "success" }, JsonRequestBehavior.AllowGet)); } catch (Exception e) { return(Json(new { result = e.Message }, JsonRequestBehavior.AllowGet)); } }