public override ValidationOutput DTOIsValidForUpdate(FinishDto consideredDto) { ValidationOutput validationOutput = new ValidationOutputBadRequest(); if (!ReferenceIsValid(consideredDto.Reference)) { validationOutput.AddError("Reference of finish", "New reference '" + consideredDto.Reference + "' is invalid!"); } if (!NameIsValid(consideredDto.Name)) { validationOutput.AddError("Name of finish", "New name '" + consideredDto.Name + "' is invalid!"); } if (!DescriptionIsValid(consideredDto.Description)) { validationOutput.AddError("Description of finish", "New description '" + consideredDto.Description + "' is invalid!"); } if (consideredDto.Price != null) { ValidationOutput priceDTOValidationOutput = _priceDTOValidator.DTOIsValid(consideredDto.Price); if (priceDTOValidationOutput.HasErrors()) { priceDTOValidationOutput.AppendToAllkeys("Finish '" + consideredDto.Reference + "' | "); validationOutput.Join(priceDTOValidationOutput); } } else { validationOutput.AddError("Price of finish", "The price has can not be null!"); } return(validationOutput); }
public override ValidationOutput DTOIsValidForUpdate(MaterialDto consideredDto) { ValidationOutput validationOutput = new ValidationOutputBadRequest(); if (consideredDto.Name != null) { if (!NameIsValid(consideredDto.Name)) { validationOutput.AddError("Name of material", "New name'" + consideredDto.Name + "' is not valid!"); } } if (consideredDto.Description != null) { if (!DescriptionIsValid(consideredDto.Description)) { validationOutput.AddError("Description of material", "New description'" + consideredDto.Description + "' is not valid!"); } } if (consideredDto.Price != null) { ValidationOutput priceDTOValidationOutput = _priceDTOValidator.DTOIsValid(consideredDto.Price); if (priceDTOValidationOutput.HasErrors()) { priceDTOValidationOutput.AppendToAllkeys("Material '" + consideredDto.Reference + "' > "); validationOutput.Join(priceDTOValidationOutput); } } return(validationOutput); }
public override ValidationOutput DTOIsValidForUpdate(ProductDto consideredDto) { ValidationOutput validationOutput = new ValidationOutputBadRequest(); if (consideredDto.Name != null) { if (!NameIsValid(consideredDto.Name)) { validationOutput.AddError("Name of product", "New name '" + consideredDto.Name + "' is not valid!"); } } if (consideredDto.Description != null) { if (!DescriptionIsValid(consideredDto.Description)) { validationOutput.AddError("Description of product", "New description '" + consideredDto.Description + "' is not valid!"); } } if (consideredDto.Price != null) { ValidationOutput priceDTOValidationOutput = _priceDTOValidator.DTOIsValid(consideredDto.Price); if (priceDTOValidationOutput.HasErrors()) { priceDTOValidationOutput.AppendToAllkeys("Product '" + consideredDto.Reference + "' > "); validationOutput.Join(priceDTOValidationOutput); } } if (consideredDto.SlotDefinition != null) { ValidationOutput slotDefinitionDTOValidationOutput = _slotDefinitionDTOValidator.DTOIsValid(consideredDto.SlotDefinition); if (slotDefinitionDTOValidationOutput.HasErrors()) { slotDefinitionDTOValidationOutput.AppendToAllkeys("Product '" + consideredDto.Reference + "' > "); validationOutput.Join(slotDefinitionDTOValidationOutput); } } var modelGroup = consideredDto.ModelGroup; if (modelGroup != null) { ValidationOutput modelGroupValidationOutput = _modelGroupDTOValidator.DTOIsValid(modelGroup); if (validationOutput.HasErrors()) { validationOutput.Join(modelGroupValidationOutput); } } return(validationOutput); }