fix : เครื่องราชย์ + บันทึกเครื่องราชย์
This commit is contained in:
parent
def2b8f7fe
commit
26ccf67dad
5 changed files with 92 additions and 5 deletions
|
|
@ -2,6 +2,7 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Requests;
|
||||
using BMA.EHR.Application.Responses.Insignias;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Models.Insignias;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
|
|
@ -26,19 +27,25 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
private readonly InsigniaPeriodsRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
|
||||
private readonly UserProfileRepository _userProfileRepository;
|
||||
|
||||
public InsigniaReceiveController(ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
InsigniaPeriodsRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
UserProfileRepository userProfileRepository)
|
||||
{
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_userProfileRepository = userProfileRepository;
|
||||
}
|
||||
|
||||
private string? AccessToken => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
|
||||
[HttpGet("{type}/{ocId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetInsigniaList(string type, Guid id, Guid ocId)
|
||||
{
|
||||
|
|
@ -151,6 +158,28 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
|
||||
if (items.Profile.Count() != 0)
|
||||
{
|
||||
foreach(var p in items.Profile)
|
||||
{
|
||||
await _userProfileRepository.PostProfileInsigniaAsync(new PostProfileInsigniaDto
|
||||
{
|
||||
ProfileId = Guid.Parse(p.FkProfileId),
|
||||
Year = item.InsigniaDateannounce.Value.Year,
|
||||
No = p.InsigniaNo,
|
||||
Volume = item.InsigniaVolume,
|
||||
Section = item.InsigniaSection,
|
||||
Page = p.InsigniaPage,
|
||||
ReceiveDate = item.InsigniaDatereceive.Value,
|
||||
InsigniaId = p.Kp7InsigniaId,
|
||||
DateAnnounce = item.InsigniaDateannounce.Value,
|
||||
Issue = item.InsigniaIssue,
|
||||
VolumeNo = item.InsigniaVolumeno.Value.ToString(),
|
||||
|
||||
|
||||
}, AccessToken);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// foreach (var i in items.Profile)
|
||||
// {
|
||||
// var profile = _context.Profiles.AsQueryable()
|
||||
|
|
@ -208,7 +237,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
// return NotFound("Profile not found!!!");
|
||||
// }
|
||||
}
|
||||
_context.SaveChanges();
|
||||
//_context.SaveChanges();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue