protected Task ThrowEntityException(ValidationCodeResult validationError, string message = "Record rejected due to following errors -") { throw new EntityValidationException(message, new List <IValidationResult>() { validationError }); }
public IValidationResult CompareVersions(T entityNew, T entityDb) { if (!(entityDb is IVersioned)) { throw new Exception("Entity is not versioned entity"); } ValidationCodeResult validationCode = new ValidationCodeResult("No Error Found", 0); var dbVersion = entityDb as IVersioned; var newVersion = entityNew as IVersioned; if (dbVersion.Version > newVersion.Version) { validationCode = new ValidationCodeResult(ErrorCodes[(int)EnumErrorBaseCode.NewVersionExists]); } else if (dbVersion.Version < newVersion.Version) { validationCode = new ValidationCodeResult(ErrorCodes[(int)EnumErrorBaseCode.VersionMismatched]); } return(validationCode); }