fix upload attatchment
This commit is contained in:
parent
aff4dcd38d
commit
68c9ed1ad9
3 changed files with 68 additions and 18 deletions
|
|
@ -1,7 +1,6 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Requests.Commands;
|
||||
using BMA.EHR.Application.Responses;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.Commands.Core;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using BMA.EHR.Domain.Models.Organizations;
|
||||
|
|
@ -48,7 +47,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
case "C-PM-01":
|
||||
case "C-PM-02":
|
||||
case "C-PM-03":
|
||||
result = await GetReceiver01(command);
|
||||
result = await GetReceiver01Async(command);
|
||||
break;
|
||||
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
|
||||
}
|
||||
|
|
@ -61,7 +60,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<List<CommandReceiver>> GetReceiver01(Command command)
|
||||
private async Task<List<CommandReceiver>> GetReceiver01Async(Command command)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -120,6 +119,32 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
#region " Execute and Deploy "
|
||||
|
||||
private async Task ExecuteCommandByTypeAsync(Command command)
|
||||
{
|
||||
switch (command.CommandType.CommandCode.Trim().ToUpper())
|
||||
{
|
||||
case "C-PM-01":
|
||||
case "C-PM-02":
|
||||
case "C-PM-03":
|
||||
await ExecuteCommand01Async(command);
|
||||
break;
|
||||
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private async Task ExecuteCommand01Async(Command command)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -579,17 +604,21 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
try
|
||||
{
|
||||
var command = await _dbContext.Set<Command>().Include(x => x.Documents).FirstOrDefaultAsync(c => c.Id == id);
|
||||
var command = await _dbContext.Set<Command>()
|
||||
.Include(x => x.Documents)
|
||||
//.ThenInclude(x =>x.Document)
|
||||
.FirstOrDefaultAsync(c => c.Id == id);
|
||||
|
||||
if (command == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
// insert new record to comand Document
|
||||
var exist = command.Documents.Where(x => x.Category == category).ToList();
|
||||
if (exist.Any())
|
||||
{
|
||||
_dbContext.Set<CommandDocument>().RemoveRange(exist);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
//var exist = command.Documents.Where(x => x.Category == category).ToList();
|
||||
//if (exist.Any())
|
||||
//{
|
||||
// _dbContext.Set<CommandDocument>().RemoveRange(exist);
|
||||
// await _dbContext.SaveChangesAsync();
|
||||
//}
|
||||
|
||||
// insert new Record
|
||||
command.Documents.Add(document);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue