ยืม คืน สำนักตัวเอง
This commit is contained in:
parent
97b85a34e7
commit
5065ad3269
2 changed files with 9 additions and 8 deletions
|
|
@ -6,7 +6,7 @@ namespace BMA.EHR.Application.Requests
|
|||
public class InsigniaBorrowRequest
|
||||
{
|
||||
public DateTime BorrowDate { get; set; }
|
||||
public Guid BorrowOrganizationId { get; set; }
|
||||
public Guid? BorrowOrganizationId { get; set; }
|
||||
public Guid InsigniaNoteProfileId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -406,7 +406,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// แก้ไขยืมเครื่องราชฯ
|
||||
/// ยืมเครื่องราชฯ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
|
|
@ -416,11 +416,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
[HttpPost("borrow")]
|
||||
public async Task<ActionResult<ResponseObject>> PostBorrowInsignia([FromBody] InsigniaBorrowRequest req)
|
||||
{
|
||||
var organization = await _context.Organizations.AsQueryable()
|
||||
.Include(x => x.OrganizationOrganization)
|
||||
.FirstOrDefaultAsync(x => x.Id == req.BorrowOrganizationId);
|
||||
if (organization == null)
|
||||
return Error(GlobalMessages.OrganizationNotFound);
|
||||
|
||||
var insigniaNoteProfile = await _context.InsigniaNoteProfiles.AsQueryable()
|
||||
.Include(x => x.RequestInsignia)
|
||||
|
|
@ -431,6 +426,12 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
if (insigniaNoteProfile.Status != "DONE")
|
||||
return Error(GlobalMessages.InsigniaNoBorrow);
|
||||
|
||||
var organization = await _context.Organizations.AsQueryable()
|
||||
.Include(x => x.OrganizationOrganization)
|
||||
.FirstOrDefaultAsync(x => x.Id == insigniaNoteProfile.Profile.OcId);
|
||||
if (organization == null)
|
||||
return Error(GlobalMessages.OrganizationNotFound);
|
||||
|
||||
var insigniaManage = await _context.InsigniaManages.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Year == insigniaNoteProfile.InsigniaNote.Year && x.Insignia == insigniaNoteProfile.RequestInsignia);
|
||||
if (insigniaManage == null)
|
||||
|
|
@ -472,7 +473,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// แก้ไขคืนเครื่องราชฯ
|
||||
/// คืนเครื่องราชฯ
|
||||
/// </summary>
|
||||
/// <param name="insigniaManageProfileId">Id ยืมเครื่องราช</param>
|
||||
/// <returns></returns>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue