add modified the check logic if insert > 0 else > 1.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user