Exemplo n.º 1
0
        public async Task <string> ReadValueAsync(long tenantId, string name)
        {
            var feature = _manager.Find(name);

            if (!feature.HasValue)
            {
                throw new FrameworkException($"there is no feature with name: {name}");
            }

            var value = await _store.ReadValueAsync(tenantId, feature.Value);

            return(value ?? feature.Value.DefaultValue);
        }
Exemplo n.º 2
0
        public void ActivateFeature(long featureId, long adminId)
        {
            var feature = _featureService.Find(featureId);

            if (feature == null)
            {
                throw new NotFoundException(ErrorCodes.FeatureNotFound);
            }
            if (feature.Type == Enums.FeatureType.Restaurant && feature.Restaurants.Count(x => x.IsActive && !x.IsDeleted) <= 0)
            {
                throw new NotFoundException(ErrorCodes.RestaurantIsNotActivated);
            }
            feature.IsActive   = true;
            feature.ModifiedBy = adminId;
            feature.ModifyTime = DateTime.Now;
            _featureService.Update(feature);
            SaveChanges();
        }