fix dev@frappet และ เพิ่ม endpoint เพื่อ update leave-beginning profile
This commit is contained in:
parent
fe40df025f
commit
5887b148b6
4 changed files with 120 additions and 80 deletions
|
|
@ -363,6 +363,34 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
[HttpPatch("update-profile")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateProfileAsync([FromBody] EditProfileDto req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var leaveBeginnings = await _context.LeaveBeginnings
|
||||
.Where(x => x.ProfileId == req.ProfileId)
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var item in leaveBeginnings)
|
||||
{
|
||||
item.Prefix = req.Prefix;
|
||||
item.FirstName = req.FirstName;
|
||||
item.LastName = req.LastName;
|
||||
_context.LeaveBeginnings.Update(item);
|
||||
}
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
return Success("อัพเดทข้อมูลสำเร็จ");
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// <summary>
|
||||
/// แก้ไขรายการ
|
||||
|
|
|
|||
|
|
@ -30,6 +30,18 @@ namespace BMA.EHR.Leave.Service.DTOs.LeaveBeginnings
|
|||
public int BeginningLeaveCount { get; set; } = 0;
|
||||
}
|
||||
|
||||
public class EditProfileDto
|
||||
{
|
||||
[Required]
|
||||
public Guid ProfileId { get; set; } = Guid.Empty;
|
||||
[Required]
|
||||
public string Prefix { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public string LastName {get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
|
||||
public class ScheduleEditLeaveBeginningDto
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue