fix : Update LeaveRequest Error Tracking Entity Id
Some checks failed
release-dev / release-dev (push) Failing after 13s
Some checks failed
release-dev / release-dev (push) Failing after 13s
This commit is contained in:
parent
d67e0450e5
commit
069f427459
5 changed files with 19 additions and 8 deletions
|
|
@ -8,6 +8,8 @@ namespace BMA.EHR.Application.Common.Interfaces
|
|||
|
||||
void Attatch<T>(T entity) where T : class;
|
||||
|
||||
void Detach<T>(T entity) where T : class;
|
||||
|
||||
Task<int> SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ namespace BMA.EHR.Application.Repositories.Leaves
|
|||
(entity as EntityBase).LastUpdatedAt = DateTime.Now;
|
||||
}
|
||||
|
||||
_dbContext.Detach(entity);
|
||||
_dbSet.Update(entity);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public override async Task<LeaveRequest?> GetByIdAsync(Guid id)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
//.AsNoTracking()
|
||||
.Include(x => x.LeaveDocument)
|
||||
.ThenInclude(x => x.Document)
|
||||
.Include(x => x.LeaveDraftDocument)
|
||||
|
|
@ -109,6 +110,9 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public override async Task<LeaveRequest> UpdateAsync(LeaveRequest entity)
|
||||
{
|
||||
// detach
|
||||
//_dbContext.Detach(entity);
|
||||
|
||||
if (entity.LeaveCancelDocument != null)
|
||||
_dbContext.Attatch(entity.LeaveCancelDocument);
|
||||
|
||||
|
|
@ -121,13 +125,12 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
{
|
||||
_dbContext.Attatch(d);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (entity.Type != null)
|
||||
{
|
||||
|
||||
_dbContext.Attatch(entity.Type);
|
||||
//_dbContext.Attatch(entity.Type);
|
||||
//_dbContext.Detach(entity.Type);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -49,5 +49,10 @@ namespace BMA.EHR.Infrastructure.Persistence
|
|||
{
|
||||
Attach(entity);
|
||||
}
|
||||
|
||||
public void Detach<T>(T entity) where T : class
|
||||
{
|
||||
base.Entry(entity).State = EntityState.Detached;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@
|
|||
"ConnectionStrings": {
|
||||
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
||||
//"DefaultConnection": "server=192.168.1.81;user=root;password=adminVM123;port=4061;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
"DefaultConnection": "server=192.168.1.81;user=root;password=adminVM123;port=4063;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
//"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
//"DefaultConnection": "server=192.168.1.81;user=root;password=adminVM123;port=4063;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
"ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
//"LeaveConnection": "server=192.168.4.11;user=root;password=P@ssw0rd;port=3306;database=bma_ehr_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
//"LeaveConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_leave_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
"LeaveConnection": "server=192.168.1.81;user=root;password=adminVM123;port=4063;database=bma_ehr_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
"LeaveConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_leave_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
//"LeaveConnection": "server=192.168.1.81;user=root;password=adminVM123;port=4063;database=bma_ehr_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
},
|
||||
"Jwt": {
|
||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue