Merge branch 'develop' into working
This commit is contained in:
commit
7d876332ba
1 changed files with 16 additions and 8 deletions
|
|
@ -468,20 +468,28 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
[HttpPut("return/{insigniaManageProfileId:length(36)}")]
|
||||
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()
|
||||
.Include(x => x.BorrowOrganization)
|
||||
.FirstOrDefaultAsync(x => x.Id == insigniaManageProfileId);
|
||||
if (uppdated == null)
|
||||
return Error(GlobalMessages.InsigniaManageNotFound);
|
||||
|
||||
uppdated.Status = true;
|
||||
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.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
uppdated.LastUpdateUserId = UserId ?? "";
|
||||
|
|
@ -511,7 +519,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
return Error(GlobalMessages.InsigniaTypeNotFound);
|
||||
var data = await _context.InsigniaManageProfiles.AsQueryable()
|
||||
.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)
|
||||
.Select(p => new
|
||||
{
|
||||
|
|
@ -569,7 +577,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
public async Task<ActionResult<ResponseObject>> GetBorrowReturnInsignia(Guid insigniaManageProfileId)
|
||||
{
|
||||
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
|
||||
{
|
||||
Id = p.Id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue