From 0234925827b0a44314c0ceeee6a5248e553e4545 Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Tue, 2 Jul 2024 02:54:38 +0700 Subject: [PATCH] fix Put Note/{insigniaNoteId} API --- .../Controllers/InsigniaRequestController.cs | 64 ++++++++++++------- 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/BMA.EHR.Insignia.Service/Controllers/InsigniaRequestController.cs b/BMA.EHR.Insignia.Service/Controllers/InsigniaRequestController.cs index 807a2324..2de7d289 100644 --- a/BMA.EHR.Insignia.Service/Controllers/InsigniaRequestController.cs +++ b/BMA.EHR.Insignia.Service/Controllers/InsigniaRequestController.cs @@ -1738,29 +1738,49 @@ namespace BMA.EHR.Insignia.Service.Controllers if (req.DateReceive != null && req.Date != null) { profileInsignia.Status = "DONE"; - await _context.ProfileInsignias.AddAsync(new ProfileInsignia + + var profileInsigniaBody = new PostProfileInsigniaDto { - Year = insigniaNote.Year, - No = req.No, - Issue = req.VolumeNo, - VolumeNo = req.VolumeNo, - //Volume = req.Volume, - Section = req.Section, - Page = req.Page, - DateAnnounce = req.Date, - ReceiveDate = req.DateReceive, - InsigniaType = insignia.InsigniaType == null ? null : insignia.InsigniaType.Name, - Insignia = insignia, - // RefCommandNo = req.RefCommandNo, - // RefCommandDate = req.RefCommandDate, - ProfileId = profile.Id, - CreatedFullName = FullName ?? "System Administrator", - CreatedUserId = UserId ?? "", - CreatedAt = DateTime.Now, - LastUpdateFullName = FullName ?? "System Administrator", - LastUpdateUserId = UserId ?? "", - LastUpdatedAt = DateTime.Now, - }); + profileId = profileInsignia.ProfileId.Value, + year = insigniaNote.Year, + no = profileInsignia.No, + volumeNo = profileInsignia.VolumeNo, + section = profileInsignia.Section, + page = profileInsignia.Page, + receiveDate = profileInsignia.DateReceive.Value, + dateAnnounce = profileInsignia.Date.Value, + insigniaId = profileInsignia.RequestInsignia.Id, + issue = "", + note = "", + refCommandDate = null, + refCommandNo = "", + volume = "", + + }; + await _userProfileRepository.PostProfileInsigniaAsync(profileInsigniaBody, AccessToken); + //await _context.ProfileInsignias.AddAsync(new ProfileInsignia + //{ + // Year = insigniaNote.Year, + // No = req.No, + // Issue = req.VolumeNo, + // VolumeNo = req.VolumeNo, + // //Volume = req.Volume, + // Section = req.Section, + // Page = req.Page, + // DateAnnounce = req.Date, + // ReceiveDate = req.DateReceive, + // InsigniaType = insignia.InsigniaType == null ? null : insignia.InsigniaType.Name, + // Insignia = insignia, + // // RefCommandNo = req.RefCommandNo, + // // RefCommandDate = req.RefCommandDate, + // ProfileId = profile.Id, + // CreatedFullName = FullName ?? "System Administrator", + // CreatedUserId = UserId ?? "", + // CreatedAt = DateTime.Now, + // LastUpdateFullName = FullName ?? "System Administrator", + // LastUpdateUserId = UserId ?? "", + // LastUpdatedAt = DateTime.Now, + //}); } } }