diff --git a/BMA.EHR.Leave.Service/Controllers/LeaveController.cs b/BMA.EHR.Leave.Service/Controllers/LeaveController.cs index 6938c229..e0d3a711 100644 --- a/BMA.EHR.Leave.Service/Controllers/LeaveController.cs +++ b/BMA.EHR.Leave.Service/Controllers/LeaveController.cs @@ -343,7 +343,7 @@ namespace BMA.EHR.Leave.Service.Controllers EndTimeAfternoon = duty == null ? "00:00" : duty.EndTimeAfternoon, Description = duty == null ? "-" : duty.Description, CheckInTime = data.CheckIn, - CheckInId = data.Id, + CheckInId = data.CheckOut == null ? data.Id : null, }; } @@ -382,7 +382,7 @@ namespace BMA.EHR.Leave.Service.Controllers var currentCheckIn = await _userTimeStampRepository.GetTimestampByDateAsync(Guid.Parse(UserId), currentDate); if (currentCheckIn != null) { - throw new Exception("ไม่สามารถลงเวลาได้ เนืองจากมีการลงเวลาในวันนี้แล้ว!"); + return Error(new Exception("ไม่สามารถลงเวลาได้ เนืองจากมีการลงเวลาในวันนี้แล้ว!"), (int)StatusCodes.Status400BadRequest); } @@ -419,7 +419,7 @@ namespace BMA.EHR.Leave.Service.Controllers } else { - throw new Exception(GlobalMessages.DataNotFound); + return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound); } } @@ -447,7 +447,7 @@ namespace BMA.EHR.Leave.Service.Controllers if (duty == null) { - throw new Exception(GlobalMessages.DataNotFound); + return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound); } var checkin_base = DateTime.Parse($"{DateTime.Now.ToString("yyyy-MM-dd")} {duty.StartTimeMorning}");