Exemplo n.º 1
0
        // Validate Versie
        public async Task <string> ValidateVersie(long productVersieID)
        // Valideer product versie
        {
            try
            {
                // Haal versie op
                ProductVersie pv = await this.GetFrom(productVersieID);

                if (pv == null)
                {
                    return("Producte Versie niet gevonden");
                }

                if (pv.Product == null)
                {
                    return("Fout bij inladen onderliggend product van Product Versie");
                }

                Ivalidator validator = ValidatorCollection.GetValidators().Where(x => x.MachineOnderdeelID.Equals(pv.Product.MachineOnderdeelId)).FirstOrDefault();

                if (validator == null)
                {
                    return($"Geen validator gevonden voor machine onderdeel met id: {pv.Product.MachineOnderdeelId}");
                }

                string validatorResult = validator.Validate(pv);

                if (validatorResult.ToUpper() != "OK")
                {
                }

                return(validatorResult);
            }
            catch (Exception ex)
            {
                throw;
            }
        }