Esempio n. 1
0
 public IEnumerable <AppOverrideResponse> GetAll(string application)
 {
     return(_readService.GetAll(new AppOverrideRequest()
     {
         Application = application
     }));
 }
Esempio n. 2
0
        /// <inheritdoc />
        public async Task HandleEvent(PropertyDefinitionUpdatedEvent eventData, CancellationToken ct)
        {
            var definition = _dynamicMetadataDefinition.GetById(eventData.DefinitionId);
            var allMovies  = _movieReadService.GetAll();
            var validator  = _validationFactory.GetValidator(definition);

            var propertyInDefinition = definition.Properties.Single(x => x.Id == eventData.UpdatedPropertyKey);

            foreach (var movie in allMovies)
            {
                var matchedMetadatas = movie.Metadata.Where(x => x.DefinitionId == eventData.DefinitionId).ToList();

                if (matchedMetadatas.Any())
                {
                    foreach (var matchedMetadata in matchedMetadatas)
                    {
                        var property = matchedMetadata.Properties.Single(x => x.Id == eventData.UpdatedPropertyKey);

                        bool alreadySetStatus = false;
                        if (property.HasDefaultValue)
                        {
                            var copy = _mapper.Map <DynamicMetadataProperty>(propertyInDefinition);
                            copy.HasDefaultValue = true;

                            matchedMetadata.Properties.Remove(property);
                            matchedMetadata.Properties.Add(copy);
                        }
                        else if (property.Type != propertyInDefinition.Type)
                        {
                            property.State   = PropertyState.UsesOldType;
                            alreadySetStatus = true;
                        }

                        var validationErrors = validator.Validate(matchedMetadata, movie);

                        if (validationErrors.Any() && !alreadySetStatus)
                        {
                            property.State = PropertyState.Invalidated;
                        }
                    }

                    _movieWriteService.UpdateItem(movie, ct);
                }
            }
        }
Esempio n. 3
0
        /// <inheritdoc />
        ///
        public async Task HandleEvent(PropertyRemovedFromMetadataDefinitionEvent eventData, CancellationToken ct)
        {
            var allMovies = _movieReadService.GetAll();

            foreach (var movie in allMovies)
            {
                var matchedMetadatas = movie.Metadata.Where(x => x.DefinitionId == eventData.DefinitionId).ToList();

                if (matchedMetadatas.Any())
                {
                    foreach (var matchedMetadata in matchedMetadatas)
                    {
                        var property = matchedMetadata.Properties.Single(x => x.Id == eventData.RemovedPropertyKey);
                        property.State = PropertyState.MarkedAsDeleted;
                    }

                    _movieWriteService.UpdateItem(movie, ct);
                }
            }
        }
        /// <inheritdoc />
        public async Task HandleEvent(PropertyAddedToMetadataDefinitionEvent eventData, CancellationToken ct)
        {
            var allMovies         = _movieReadService.GetAll();
            var updatedDefinition = _dynamicMetadataDefinition.GetById(eventData.DefinitionId);
            var addedProperty     = updatedDefinition.Properties.SingleOrDefault(x => x.Id == eventData.AddedPropertyId);

            foreach (var movie in allMovies)
            {
                var matchedMetadatas = movie.Metadata.Where(x => x.DefinitionId == eventData.DefinitionId).ToList();

                if (matchedMetadatas.Any())
                {
                    foreach (var matchedMetadata in matchedMetadatas)
                    {
                        var copy = _mapper.Map <DynamicMetadataProperty>(addedProperty);
                        copy.HasDefaultValue = true;
                        matchedMetadata.Properties.Add(copy);
                    }

                    _movieWriteService.UpdateItem(movie, ct);
                }
            }
        }
        public async Task HandleEvent(RefreshValidationEvent eventData, CancellationToken ct)
        {
            var allMovies          = _movieReadService.GetAll();
            var metadataDefinition = _metadataReadService.GetById(eventData.DefinitionId);
            var validators         = _validationFactory.GetValidator(metadataDefinition);

            foreach (var movie in allMovies)
            {
                var updatedDefinitions = movie.Metadata.Where(x => x.DefinitionId == metadataDefinition.Id).ToList();

                if (!updatedDefinitions.Any())
                {
                    continue;
                }

                bool isValidMovie = true;
                foreach (var definition in updatedDefinitions)
                {
                    var propertyValidationErrors = validators.Validate(definition, movie);

                    if (propertyValidationErrors.Any())
                    {
                        definition.IsValid = false;
                        isValidMovie       = false;
                    }

                    if (!propertyValidationErrors.Any())
                    {
                        definition.IsValid = true;
                    }
                }

                movie.IsValid = isValidMovie;

                _movieWriteService.UpdateItem(movie, ct);
            }
        }
 public async Task <List <Racun> > GetAll()
 {
     return(await _readService.GetAll());
 }
        public async Task <List <Product> > GetAll(int num)
        {
            var result = await Task.FromResult(_readService.GetAll <Product>($"Select * from [production].[products] where gender_id={num}", null, commandType: CommandType.Text));

            return(result);
        }
Esempio n. 8
0
 public async Task <List <Stanje> > GetAll()
 {
     return(await _accountBalanceReadService.GetAll());
 }
Esempio n. 9
0
 public IEnumerable <T> GetAll()
 {
     return(_readService.GetAll());
 }
Esempio n. 10
0
 public IEnumerable <Read> GetAllReads()
 {
     return(_readService.GetAll());
 }
Esempio n. 11
0
        public virtual IActionResult Get()
        {
            var result = readService.GetAll();

            return(Ok(result));
        }
Esempio n. 12
0
 public async Task <List <Klijent> > GetAll()
 {
     return(await _clientRead.GetAll());
 }
Esempio n. 13
0
 public IEnumerable <ToggleResponse> GetAll()
 {
     return(_readService.GetAll(null));
 }
        public virtual HttpResponseMessage Get()
        {
            var result = readService.GetAll();

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }