add modified the check logic if insert > 0 else > 1.

This commit is contained in:
Kham
2021-09-01 20:55:31 +10:00
parent 85abcfa068
commit 39a7931a97
3 changed files with 6 additions and 5 deletions
@@ -162,16 +162,17 @@ namespace CarParkValidationAPI.Repository
};
}
public async Task<ResultModel<int>> CheckConcessionValidationStaffLinkNoAsync(string staffLinkNo, string concessionCard, DateTime currentDate)
public async Task<ResultModel<int>> CheckConcessionValidationStaffLinkNoAsync(string staffLinkNo, string concessionCard, DateTime currentDate, int id)
{
int statuscode = 1;
int result = 1;
int number = id < 1 ? 0 : 1; // if insert check > 0 . if modify > 1
string message = "warning you already add concession card on this date!";
try
{
var anyRecord = await _context.SelectCheckConcessionValidationAsync(currentDate.ToLocalTime().Date, concessionCard, staffLinkNo);
if (anyRecord.Count > 1)
if (anyRecord.Count > number)
{
result = -1;
}