fix : create and edit leave request

This commit is contained in:
Suphonchai Phoonsawat 2024-07-08 17:09:27 +07:00
parent 9c696be46e
commit 8ad90f18f0
2 changed files with 15 additions and 4 deletions

View file

@ -72,7 +72,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
public override async Task<LeaveRequest?> GetByIdAsync(Guid id)
{
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
.Include(x => x.LeaveDocument)
.ThenInclude(x => x.Document)
.Include(x => x.LeaveDraftDocument)
@ -112,7 +112,11 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
// _dbContext.Attatch(entity.LeaveDocument);
if (entity.Type != null)
{
_dbContext.Attatch(entity.Type);
}
return await base.UpdateAsync(entity);
}