แก้คิวรี่จัดสรรเครื่องราช
This commit is contained in:
parent
069ee389e0
commit
0e9bf54c5c
1 changed files with 16 additions and 8 deletions
|
|
@ -468,20 +468,28 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
[HttpPut("return/{insigniaManageProfileId:length(36)}")]
|
[HttpPut("return/{insigniaManageProfileId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> PutReturnInsignia([FromBody] InsigniaReturnRequest req, Guid insigniaManageProfileId)
|
public async Task<ActionResult<ResponseObject>> PutReturnInsignia([FromBody] InsigniaReturnRequest req, Guid insigniaManageProfileId)
|
||||||
{
|
{
|
||||||
var organization = await _context.Organizations.AsQueryable()
|
|
||||||
.Include(x => x.OrganizationOrganization)
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == req.ReturnOrganizationId);
|
|
||||||
if (organization == null)
|
|
||||||
return Error(GlobalMessages.OrganizationNotFound);
|
|
||||||
|
|
||||||
var uppdated = await _context.InsigniaManageProfiles.AsQueryable()
|
var uppdated = await _context.InsigniaManageProfiles.AsQueryable()
|
||||||
|
.Include(x => x.BorrowOrganization)
|
||||||
.FirstOrDefaultAsync(x => x.Id == insigniaManageProfileId);
|
.FirstOrDefaultAsync(x => x.Id == insigniaManageProfileId);
|
||||||
if (uppdated == null)
|
if (uppdated == null)
|
||||||
return Error(GlobalMessages.InsigniaManageNotFound);
|
return Error(GlobalMessages.InsigniaManageNotFound);
|
||||||
|
|
||||||
uppdated.Status = true;
|
uppdated.Status = true;
|
||||||
uppdated.ReturnDate = req.ReturnDate;
|
uppdated.ReturnDate = req.ReturnDate;
|
||||||
uppdated.ReturnOrganization = organization.OrganizationOrganization;
|
if (req.ReturnOrganizationId == Guid.Parse("00000000-0000-0000-0000-000000000000"))
|
||||||
|
{
|
||||||
|
uppdated.ReturnOrganization = uppdated.BorrowOrganization;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var organization = await _context.Organizations.AsQueryable()
|
||||||
|
.Include(x => x.OrganizationOrganization)
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == req.ReturnOrganizationId);
|
||||||
|
if (organization == null)
|
||||||
|
return Error(GlobalMessages.OrganizationNotFound);
|
||||||
|
uppdated.ReturnOrganization = organization.OrganizationOrganization;
|
||||||
|
}
|
||||||
uppdated.ReturnReason = req.ReturnReason;
|
uppdated.ReturnReason = req.ReturnReason;
|
||||||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
uppdated.LastUpdateUserId = UserId ?? "";
|
uppdated.LastUpdateUserId = UserId ?? "";
|
||||||
|
|
@ -511,7 +519,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
return Error(GlobalMessages.InsigniaTypeNotFound);
|
return Error(GlobalMessages.InsigniaTypeNotFound);
|
||||||
var data = await _context.InsigniaManageProfiles.AsQueryable()
|
var data = await _context.InsigniaManageProfiles.AsQueryable()
|
||||||
.Where(x => x.InsigniaNoteProfile.RequestInsignia.InsigniaType == insigniaType)
|
.Where(x => x.InsigniaNoteProfile.RequestInsignia.InsigniaType == insigniaType)
|
||||||
.Where(x => x.InsigniaManageOrganiation.InsigniaManage.Year == year)
|
.Where(x => year == 0 ? x.Id != null : x.InsigniaManageOrganiation.InsigniaManage.Year == year)
|
||||||
.OrderByDescending(x => x.CreatedAt)
|
.OrderByDescending(x => x.CreatedAt)
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
{
|
{
|
||||||
|
|
@ -569,7 +577,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
public async Task<ActionResult<ResponseObject>> GetBorrowReturnInsignia(Guid insigniaManageProfileId)
|
public async Task<ActionResult<ResponseObject>> GetBorrowReturnInsignia(Guid insigniaManageProfileId)
|
||||||
{
|
{
|
||||||
var data = await _context.InsigniaManageProfiles.AsQueryable()
|
var data = await _context.InsigniaManageProfiles.AsQueryable()
|
||||||
.Where(x => insigniaManageProfileId == Guid.Parse("00000000-0000-0000-0000-000000000000") ? x.Id != null : x.Id == insigniaManageProfileId)
|
.Where(x => x.Id == insigniaManageProfileId)
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
{
|
{
|
||||||
Id = p.Id,
|
Id = p.Id,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue