From 3bac0e2e886d513a3b6652bdf1b8a256f17170dc Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Wed, 16 Oct 2024 09:51:23 +0700 Subject: [PATCH] Change Selection Field --- .../Controllers/InsigniaRequestController.cs | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs b/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs index 8096bb67..15d8c383 100644 --- a/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs +++ b/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs @@ -1447,7 +1447,13 @@ namespace BMA.EHR.Insignia.Service.Controllers .Select(x => new { Id = x.Id, - Profile = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken), + x.Prefix, + x.FirstName, + x.LastName, + x.Position, + x.CitizenId, + x.ProfileType, + //Profile = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken), OcId = Guid.Parse("e8493cd1-d371-402e-add6-566e68d5d1b3"), // TODO: ต้องมาแก้ไข RequestInsignia = x.RequestInsignia.Name, RequestInsigniaId = x.RequestInsignia.Id, @@ -1480,12 +1486,15 @@ namespace BMA.EHR.Insignia.Service.Controllers .Select(x => new { Id = x.Id, - Prefix = x.Profile == null ? "" : x.Profile.Prefix, - Position = x.Profile == null ? "" : x.Profile.Position, - ProfileType = x.Profile == null ? "" : x.Profile.ProfileType, + //Prefix = x.Profile == null ? "" : x.Profile.Prefix, + //Position = x.Profile == null ? "" : x.Profile.Position, + //ProfileType = x.Profile == null ? "" : x.Profile.ProfileType, + Prefix = x.Prefix ?? "", + Position = x.Position ?? "", + ProfileType = x.ProfileType ?? "", x.OcId, - CitizenId = x.Profile == null ? "" : x.Profile.CitizenId, - FullName = x.Profile == null ? "" : $"{x.Profile.Prefix}{x.Profile.FirstName} {x.Profile.LastName}", + CitizenId = x.CitizenId ?? "", + FullName = $"{x.Prefix ?? ""}{x.FirstName ?? ""} {x.LastName ?? ""}".Trim(), RequestInsignia = x.RequestInsignia, RequestInsigniaId = x.RequestInsigniaId, RequestInsigniaShortName = x.RequestInsigniaShortName, @@ -1628,7 +1637,13 @@ namespace BMA.EHR.Insignia.Service.Controllers .Select(x => new { Id = x.Id, - Profile = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken), + //Profile = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken), + x.CitizenId, + x.Prefix, + x.FirstName, + x.LastName, + x.ProfileType, + x.Position, OcId = Guid.Parse("e8493cd1-d371-402e-add6-566e68d5d1b3"), // TODO: ต้องมาแก้ไข RequestInsignia = x.RequestInsignia.Name, RequestInsigniaId = x.RequestInsignia.Id, @@ -1661,12 +1676,12 @@ namespace BMA.EHR.Insignia.Service.Controllers .Select(x => new { Id = x.Id, - Prefix = x.Profile == null ? "" : x.Profile.Prefix, - Position = x.Profile == null ? "" : x.Profile.Position, - ProfileType = x.Profile == null ? "" : x.Profile.ProfileType, + Prefix = x.Prefix ?? "", + Position = x.Position ?? "", + ProfileType = x.ProfileType ?? "", x.OcId, - CitizenId = x.Profile == null ? "" : x.Profile.CitizenId, - FullName = x.Profile == null ? "" : $"{x.Profile.Prefix}{x.Profile.FirstName} {x.Profile.LastName}", + CitizenId = x.CitizenId ?? "", + FullName = $"{x.Prefix ?? ""}{x.FirstName ?? ""} {x.LastName ?? ""}".Trim(), RequestInsignia = x.RequestInsignia, RequestInsigniaId = x.RequestInsigniaId, RequestInsigniaShortName = x.RequestInsigniaShortName,