บันทึกวันที่ส่งตัวกลับ

This commit is contained in:
Kittapath 2023-09-28 12:51:36 +07:00
parent ca7c06d583
commit b63b31608d
2 changed files with 28 additions and 23 deletions

View file

@ -84,6 +84,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.PositionNumberOld,
p.OrganizationPositionOld,
p.IsActive,
p.DateRepatriation,
})
.ToListAsync();
if (PlacementAdmin == true)
@ -129,6 +130,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
p.DateRepatriation,
Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
})
.FirstOrDefaultAsync();
@ -156,6 +158,7 @@ namespace BMA.EHR.Placement.Service.Controllers
data.PositionLevelOld,
data.PositionNumberOld,
data.OrganizationPositionOld,
data.DateRepatriation,
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
};
@ -225,6 +228,7 @@ namespace BMA.EHR.Placement.Service.Controllers
return Error(GlobalMessages.PlacementRepatriationNotFound, 404);
uppdated.PositionNumberOld = req.PositionNumberOld;
uppdated.DateRepatriation = req.DateRepatriation;
uppdated.OrganizationPositionOld = req.OrganizationPositionOld;
uppdated.PositionLevelOld = req.PositionLevelOld;
uppdated.PositionTypeOld = req.PositionTypeOld;
@ -316,30 +320,30 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success();
}
/// <summary>
/// วันที่ส่งตัวกลับ
/// </summary>
/// <param name="id">Id ส่งตัวกลับ</param>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("date/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> UpdateDateRepatriation([FromBody] PlacementRepatriationDateRequest req, Guid id)
{
var uppdated = await _context.PlacementRepatriations
.FirstOrDefaultAsync(x => x.Id == id);
if (uppdated == null)
return Error(GlobalMessages.PlacementRepatriationNotFound, 404);
uppdated.DateRepatriation = req.Date;
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
// /// <summary>
// /// วันที่ส่งตัวกลับ
// /// </summary>
// /// <param name="id">Id ส่งตัวกลับ</param>
// /// <returns></returns>
// /// <response code="200"></response>
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
// [HttpPut("date/{id:length(36)}")]
// public async Task<ActionResult<ResponseObject>> UpdateDateRepatriation([FromBody] PlacementRepatriationDateRequest req, Guid id)
// {
// var uppdated = await _context.PlacementRepatriations
// .FirstOrDefaultAsync(x => x.Id == id);
// if (uppdated == null)
// return Error(GlobalMessages.PlacementRepatriationNotFound, 404);
// uppdated.DateRepatriation = req.Date;
// uppdated.LastUpdateFullName = FullName ?? "System Administrator";
// uppdated.LastUpdateUserId = UserId ?? "";
// uppdated.LastUpdatedAt = DateTime.Now;
await _context.SaveChangesAsync();
// await _context.SaveChangesAsync();
return Success();
}
// return Success();
// }
}
}

View file

@ -9,6 +9,7 @@ namespace BMA.EHR.Placement.Service.Requests
public string Reason { get; set; }
public string? OrganizationPositionOld { get; set; }
public DateTime? Date { get; set; }
public DateTime? DateRepatriation { get; set; }
public string? PositionTypeOld { get; set; }
public string? PositionLevelOld { get; set; }
public string? PositionNumberOld { get; set; }