예제 #1
0
        /// <summary>
        /// Record a student who absent on the course
        /// </summary>
        /// <param name="type"></param>
        /// <param name="studentId"></param>
        /// <param name="dispatchId"></param>
        /// <returns></returns>
        public string AddStudentAbsence(string type, int studentId, int dispatchId)
        {
            Validator validator = new Validator();
            // Validate the user input here.
            if (!validator.Make(new string[] { type, studentId + "", dispatchId + "" },
                new string[] { "required", "required", "required" },
                new string[] { "type", "studentId", "dispatchId" }))
            {
                return resultSetView.Error(validator.GetDetail());
            }

            AbsenceRepository absenceRepo = new AbsenceRepository();

            bool ret = absenceRepo.AddStudentAbsence(type, studentId, dispatchId, Auth.User().Id);

            return ret ? resultSetView.Success() : resultSetView.Error();
        }