private void ValidatePassport(PassportModel model) { var passport = new PassportValidation.Models.PassportModel { PassportNumber = model.PassportNumber, Nationality = model.Nationality, Gender = model.Gender, DateOfBirth = model.DateOfBirth, DateOfExpiration = model.DateOfExpiration, MzrPassportNumber = model.MzrPassportNumber, PassportNumberChecksum = model.PassportNumberChecksum, MzrNationalityCode = model.MzrNationalityCode, MzrDateOfBirth = model.MzrDateOfBirth, DOBChecksum = model.DOBChecksum, Sex = model.Sex, PassportExpiration = model.PassportExpiration, ExpirationChecksum = model.ExpirationChecksum, PersonalNumber = model.PersonalNumber, PersonalNumberChecksum = model.PersonalNumberChecksum, FinalChecksum = model.FinalChecksum, PassportNumberChecksumValid = model.PassportNumberChecksumValid, DateOfBirthChecksumValid = model.DateOfBirthChecksumValid, PassportExpirationChecksumValid = model.PassportExpirationChecksumValid, PersonalNumberChecksumValid = model.PersonalNumberChecksumValid, FinalChecksumValid = model.FinalChecksumValid, GenderCrossCheckValid = model.GenderCrossCheckValid, DateOfBirthCrossCheckValid = model.DateOfBirthCrossCheckValid, PassportExpCrossCheckValid = model.PassportExpCrossCheckValid, NationalityCrossCheckValid = model.NationalityCrossCheckValid, PassportNoCrossCheckValid = model.PassportNoCrossCheckValid, }; _validatePassport.Validate(passport); model.PassportNumberChecksumValid = passport.PassportNumberChecksumValid; model.DateOfBirthChecksumValid = passport.DateOfBirthChecksumValid; model.PassportExpirationChecksumValid = passport.PassportExpirationChecksumValid; model.PersonalNumberChecksumValid = passport.PersonalNumberChecksumValid; model.FinalChecksumValid = passport.FinalChecksumValid; model.GenderCrossCheckValid = passport.GenderCrossCheckValid; model.DateOfBirthCrossCheckValid = passport.DateOfBirthCrossCheckValid; model.PassportExpCrossCheckValid = passport.PassportExpCrossCheckValid; model.NationalityCrossCheckValid = passport.NationalityCrossCheckValid; model.PassportNoCrossCheckValid = passport.PassportNoCrossCheckValid; }
public IActionResult ValidateMZR([FromBody] PassportModel model) { try { ValidatePassport(model); var data = new Message <PassportModel> { Data = model, IsSuccess = true, ReturnMessage = "" }; return(Ok(data)); } catch (Exception e) { return(this.StatusCode(StatusCodes.Status500InternalServerError, "Validation Method Error")); } }