Example #1
0
        public DatabaseInfoDto AddNewRack(DatabaseInfoDto dto)
        {
            var dbEntity = _repository.Get(dto.Hash);

            _databaseInfoHandler.AddNewRack(dbEntity);
            _persister.Save();
            return(new DatabaseInfoDtoConverter().ToDto(dbEntity));
        }
Example #2
0
        public DatabaseInfoDto UpdateDatabaseNames(DatabaseInfoDto dto)
        {
            var dbEntity  = _repository.Get(dto.Hash);
            var converter = new DatabaseInfoDtoConverter();

            converter.Merge(dbEntity, dto);

            _persister.Save();

            return(converter.ToDto(dbEntity));
        }
Example #3
0
 public void Merge(DatabaseInfo dbEntity, DatabaseInfoDto dto)
 {
     dbEntity.Name = dto.Name;
     foreach (var rack in dbEntity.Racks)
     {
         var newRack = dto.Racks.First(nr => nr.Hash == rack.Hash);
         rack.Name = newRack.Name;
         for (var i = 0; i < rack.MountPoints.Count; i++)
         {
             rack.MountPoints[i].Path = newRack.MountPoints[i];
         }
     }
 }