コード例 #1
0
        public bool Update(UpdateConfigurationDTO dto)
        {
            var validationResult = new UpdateConfigurationValidator().Validate(dto);

            if (validationResult.IsValid)
            {
                return(_storageProvider.Update(dto));
            }

            return(false);
        }
コード例 #2
0
        public bool Update(UpdateConfigurationDTO dto)
        {
            var filter = Builders <MongoDbConfigurationEntity> .Filter.AnyEq("_id", new ObjectId(dto.Id));

            var update = Builders <MongoDbConfigurationEntity> .Update.Set("Value", dto.Value).Set("IsActive", dto.IsActive)
                         .Set("Type", dto.Type).CurrentDate("LastModifyDate");

            var result = Collection.UpdateOne(filter, update);

            return(result.IsAcknowledged ? result.ModifiedCount > 0 : result.IsAcknowledged);
        }
コード例 #3
0
        public bool Update(UpdateConfigurationDTO dto)
        {
            using (var context = new ConfigurationContext(GetConfigurationContextOptions()))
            {
                var entity = context.Configurations.AsQueryable().FirstOrDefault(a => a.Id == int.Parse(dto.Id));
                if (entity != null)
                {
                    entity.LastModifyDate = DateTime.Now;
                    entity.Value          = dto.Value;
                    entity.Type           = dto.Type;
                    entity.IsActive       = dto.IsActive;

                    context.SaveChanges();

                    return(true);
                }

                return(false);
            }
        }
コード例 #4
0
        public bool Update(UpdateConfigurationDTO dto)
        {
            using (var dbConnection = Connection)
            {
                var query = "UPDATE \"Configuration\" SET \"Value\" = @Value,"
                            + " \"Type\" = @Type, \"IsActive\"= @IsActive, \"LastModifyDate\"= @LastModifyDate "
                            + " WHERE \"Id\" = @Id";

                dbConnection.Open();
                dbConnection.Execute(query, new
                {
                    Id             = int.Parse(dto.Id),
                    Value          = dto.Value,
                    IsActive       = dto.IsActive,
                    Type           = dto.Type,
                    LastModifyDate = DateTime.Now
                });
            }

            return(true);
        }
コード例 #5
0
 public bool Update(UpdateConfigurationDTO dto)
 {
     throw new NotImplementedException();
 }
コード例 #6
0
        public bool Update(UpdateConfigurationDTO dto)
        {
            var validationResult = new UpdateConfigurationValidator().Validate(dto);

            return(validationResult.IsValid && _storageProvider.Update(dto));
        }
コード例 #7
0
 public ActionResult <bool> Update([FromBody] UpdateConfigurationDTO dto)
 {
     return(_configurationEngine.Update(dto));
 }