public void SetNewFlagCount(Student student, int newFlagCount) { if (student.AttendanceFlags.IsNullOrEmpty()) CreateNewAttendanceFlagEntryFor(student); student.AttendanceFlags.First().FlagCount = newFlagCount; }
private static void DecrementFlagCount(Student student) { var flagCount = student.AttendanceFlags.First().FlagCount; if (flagCount > 0) student.AttendanceFlags.First().FlagCount--; }
private static void IncrementFlagCount(Student student) { if (student.AttendanceFlags.IsNullOrEmpty()) CreateNewAttendanceFlagEntryFor(student); var flagCount = student.AttendanceFlags.First().FlagCount; if (flagCount < 10) student.AttendanceFlags.First().FlagCount++; }
public virtual ActionResult CreateStudent(CreateStudentModel createStudentModel) { if (!ModelState.IsValid) return View(createStudentModel); var student = new Student(); _enrollmentMapper.Map(createStudentModel, student); _repository.Add(student); _repository.Save(); return RedirectToAction(MVC.Enrollment.EnterAcademicDetails(createStudentModel.StudentUsi.GetValueOrDefault())); }
private static void CreateNewAttendanceFlagEntryFor(Student student) { student.AttendanceFlags = new List<AttendanceFlag> { new AttendanceFlag { FlagCount = 0, StudentUSI = student.StudentUSI } }; }