From bd1a77c1a22406a29f4e2ee33b71016be1300d67 Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Thu, 14 Dec 2023 10:13:48 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=AA=E0=B8=A3=E0=B9=89=E0=B8=B2?= =?UTF-8?q?=E0=B8=87=E0=B9=83=E0=B8=9A=E0=B8=A5=E0=B8=B2=20=E0=B9=84?= =?UTF-8?q?=E0=B8=A1=E0=B9=88=E0=B8=AD=E0=B8=B1=E0=B8=9E=E0=B9=80=E0=B8=94?= =?UTF-8?q?=E0=B8=95=E0=B8=82=E0=B9=89=E0=B8=AD=E0=B8=A1=E0=B8=B9=E0=B8=A5?= =?UTF-8?q?=E0=B9=80=E0=B8=AD=E0=B8=81=E0=B8=AA=E0=B8=B2=E0=B8=A3=E0=B9=81?= =?UTF-8?q?=E0=B8=99=E0=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LeaveRequests/LeaveRequestRepository.cs | 17 +++++++++++++++++ .../Controllers/LeaveRequestController.cs | 2 -- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/BMA.EHR.Application/Repositories/Leaves/LeaveRequests/LeaveRequestRepository.cs b/BMA.EHR.Application/Repositories/Leaves/LeaveRequests/LeaveRequestRepository.cs index 74821d20..726391dd 100644 --- a/BMA.EHR.Application/Repositories/Leaves/LeaveRequests/LeaveRequestRepository.cs +++ b/BMA.EHR.Application/Repositories/Leaves/LeaveRequests/LeaveRequestRepository.cs @@ -77,6 +77,23 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests return data; } + public override async Task AddAsync(LeaveRequest entity) + { + if (entity.LeaveCancelDocument != null) + _dbContext.Attatch(entity.LeaveCancelDocument); + + if (entity.LeaveDraftDocument != null) + _dbContext.Attatch(entity.LeaveDraftDocument); + + if (entity.LeaveDocument != null) + _dbContext.Attatch(entity.LeaveDocument); + + if (entity.Type != null) + _dbContext.Attatch(entity.Type); + + return await base.AddAsync(entity); + } + public override async Task UpdateAsync(LeaveRequest entity) { if (entity.LeaveCancelDocument != null) diff --git a/BMA.EHR.Leave.Service/Controllers/LeaveRequestController.cs b/BMA.EHR.Leave.Service/Controllers/LeaveRequestController.cs index c0b83082..199bfe9b 100644 --- a/BMA.EHR.Leave.Service/Controllers/LeaveRequestController.cs +++ b/BMA.EHR.Leave.Service/Controllers/LeaveRequestController.cs @@ -9,8 +9,6 @@ using BMA.EHR.Infrastructure.Persistence; using BMA.EHR.Leave.Service.DTOs.LeaveRequest; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Routing; -using Sentry; using Swashbuckle.AspNetCore.Annotations; using System.Security.Claims; using BMA.EHR.Application.Repositories.Commands;