public async Task <AttendanceModel> CheckInAsync(int employeeId, string remarks = null) { if (employeeId == 0) { throw new ArgumentException(); } var isExists = await _attendanceRepository.GetAttendanceForTodayAsync(employeeId, null); if (isExists != null) { throw new COHHttpException(System.Net.HttpStatusCode.Found, false, "Already exists."); } AttendanceModel model = new AttendanceModel(); model.EmployeeId = employeeId; model.Remarks = remarks; model.CheckInTime = DateTime.UtcNow; model.AttendanceDate = DateTime.UtcNow; model.IsPresent = true; model.Remarks = string.Format("IN: {0}", remarks); var dataModel = await _attendanceRepository.CheckInAsync(_attendanceMapper.ConvertToDataModel(model)); return(_attendanceMapper.ConvertToModel(dataModel)); }