This commit is contained in:
parent
d6a3bdc8ba
commit
8e890af48f
1 changed files with 11 additions and 0 deletions
|
|
@ -11,6 +11,7 @@ using Newtonsoft.Json.Linq;
|
||||||
using OfficeOpenXml.ConditionalFormatting;
|
using OfficeOpenXml.ConditionalFormatting;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace BMA.EHR.Leave.Service.Controllers
|
namespace BMA.EHR.Leave.Service.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -295,6 +296,16 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
return Error("ไม่พบข้อมูลข้าราชการหรือลูกจ้าง", StatusCodes.Status404NotFound);
|
return Error("ไม่พบข้อมูลข้าราชการหรือลูกจ้าง", StatusCodes.Status404NotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check duplicate
|
||||||
|
var oldData = await _context.LeaveBeginnings.FirstOrDefaultAsync(x => x.ProfileId == req.ProfileId
|
||||||
|
&& x.LeaveTypeId == req.LeaveTypeId
|
||||||
|
&& x.LeaveYear == req.LeaveYear);
|
||||||
|
|
||||||
|
if (oldData is not null)
|
||||||
|
{
|
||||||
|
return Error("ไม่สามารถบันทึกข้อมูล เนื่องจากมีข้อมูลในระบบแล้ว");
|
||||||
|
}
|
||||||
|
|
||||||
var leaveBeginning = new LeaveBeginning();
|
var leaveBeginning = new LeaveBeginning();
|
||||||
leaveBeginning.LeaveTypeId = req.LeaveTypeId;
|
leaveBeginning.LeaveTypeId = req.LeaveTypeId;
|
||||||
leaveBeginning.LeaveYear = req.LeaveYear;
|
leaveBeginning.LeaveYear = req.LeaveYear;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue