Refactor LeaveBeginningController to simplify duplicate check and comment out LeaveYear property in EditLeaveBeginningDto #2341
This commit is contained in:
parent
006cea048d
commit
3243b3dd7c
2 changed files with 3 additions and 4 deletions
|
|
@ -590,8 +590,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
return Error("ไม่พบข้อมูลข้าราชการหรือลูกจ้าง", StatusCodes.Status404NotFound);
|
return Error("ไม่พบข้อมูลข้าราชการหรือลูกจ้าง", StatusCodes.Status404NotFound);
|
||||||
}
|
}
|
||||||
// check duplicate
|
// check duplicate
|
||||||
var oldData = await _context.LeaveBeginnings.Where(x => x.ProfileId == req.ProfileId
|
var oldData = await _context.LeaveBeginnings.Where(x => x.ProfileId == req.ProfileId).ToListAsync();
|
||||||
&& x.LeaveYear == req.LeaveYear).ToListAsync();
|
|
||||||
|
|
||||||
foreach(var item in oldData)
|
foreach(var item in oldData)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@ namespace BMA.EHR.Leave.Service.DTOs.LeaveBeginnings
|
||||||
[Required]
|
[Required]
|
||||||
public Guid ProfileId { get; set; } = Guid.Empty;
|
public Guid ProfileId { get; set; } = Guid.Empty;
|
||||||
|
|
||||||
[Required, Comment("ปีงบประมาณ")]
|
// [Required, Comment("ปีงบประมาณ")]
|
||||||
public int LeaveYear { get; set; } = 0;
|
// public int LeaveYear { get; set; } = 0;
|
||||||
|
|
||||||
public Guid? RootDnaId { get; set; }
|
public Guid? RootDnaId { get; set; }
|
||||||
public Guid? Child1DnaId { get; set; }
|
public Guid? Child1DnaId { get; set; }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue