public async Task <AttendanceModel> CheckOutAsync(int employeeId, string remarks) { if (employeeId == 0) { throw new ArgumentException(); } var model = await _attendanceRepository.GetAttendanceForTodayAsync(employeeId, null); if (model == null) { throw new ArgumentNullException(); } model.CheckOutTime = DateTime.UtcNow; model.TotalInTime = await _trackManager.TodayInDuration(employeeId); model.TotalOutTime = await _trackManager.TodayOutDuration(employeeId); model.Remarks = string.Format("{0} OUT: {1}", model.Remarks, remarks); return(_attendanceMapper.ConvertToModel(await _attendanceRepository.CheckOutAsync(model))); }