Update เอกสารแนบท้าย

This commit is contained in:
Suphonchai Phoonsawat 2023-07-28 16:30:03 +07:00
parent 7fa7304954
commit dbcf1d31b6
4 changed files with 125 additions and 7 deletions

View file

@ -312,6 +312,47 @@ namespace BMA.EHR.Application.Repositories.Commands
}
}
#region " Documents "
public async Task<List<CommandDocument>> GetCommandDocumentAsync(Guid id)
{
try
{
var docs = await _dbContext.Set<CommandDocument>()
.Include(x => x.Command)
.Include(x => x.Document)
.Where(x => x.Command.Id == id)
.ToListAsync();
return docs;
}
catch
{
throw;
}
}
#endregion
public async Task UpdateCommandInfo(Guid id, string orderNo, string orderYear, DateTime signDate)
{
try
{
var command = await _dbContext.Set<Command>().FirstOrDefaultAsync(x => x.Id == id);
if(command == null)
throw new Exception(GlobalMessages.CommandNotFound);
command.CommandExcecuteDate = signDate;
command.CommandNo = orderNo;
command.CommandYear = orderYear;
await _dbContext.SaveChangesAsync();
}
catch
{
throw;
}
}
#endregion
}