Пример #1
0
        public async Task RevertVersionAsync(Guid versionId, Guid userId)
        {
            NetworkChangesetModel changeset = await _changesetRepository.GetNetworkChangesetAsync(versionId);

            string revertSha = _versionsStorage.RevertVersion(changeset.NetworkId, changeset.Sha);

            NetworkChangesetModel revertChangeset = NetworkChangesetModel.CreateNew(
                changeset.NetworkId,
                $"Reverts \"{changeset.Comment}\"",
                userId,
                revertSha);

            await _changesetRepository.CreateChangesetAsync(revertChangeset);
        }
Пример #2
0
        public async Task <Guid> SaveVersionAsync(NewNetworkVersion version)
        {
            string json = JsonConvert.SerializeObject(version.Diagram);

            string sha = await _versionsStorage.SaveAsync(version.NetworkId, version.Comment, json);

            NetworkChangesetModel newChangeset = NetworkChangesetModel.CreateNew(
                version.NetworkId,
                version.Comment,
                version.AuthorId,
                sha);

            await _changesetRepository.CreateChangesetAsync(newChangeset);

            return(newChangeset.Id);
        }