public Guid CreateAttendanceMachine(AttendanceMachineCreationDTO attendanceMachineCreationDTO) { AttendanceEvent attendanceMachine = new AttendanceEvent( attendanceMachineCreationDTO.AttendanceEvent, true); context.AttendanceEvents.Add(attendanceMachine); context.SaveChanges(); return(attendanceMachine.Id); }
public void MarkAttendance(Guid machineId, MarkAttendanceDTO attendanceDTO) { /* * 1. Get the domain * 2. Let domain handle calls * 3. Persist the changes */ AttendanceEvent attendanceMachine = context.AttendanceEvents.Find(machineId); attendanceMachine.Mark(attendanceDTO.PersonId, attendanceDTO.AttendanceEntry, attendanceDTO.Date); context.SaveChanges(); }