Exemplo n.º 1
0
        public bool Update(UpdateConfigurationDTO dto)
        {
            var validationResult = new UpdateConfigurationValidator().Validate(dto);

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

            return(false);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
        }
 public bool Update(UpdateConfigurationDTO dto)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 6
0
        public bool Update(UpdateConfigurationDTO dto)
        {
            var validationResult = new UpdateConfigurationValidator().Validate(dto);

            return(validationResult.IsValid && _storageProvider.Update(dto));
        }
Exemplo n.º 7
0
 public ActionResult <bool> Update([FromBody] UpdateConfigurationDTO dto)
 {
     return(_configurationEngine.Update(dto));
 }