void UpdateRepo(Guid repoId, Action <RepositoryModel> transform)
        {
            var repo = _repos.GetRepository(repoId);

            transform(repo);
            _repos.Update(repo);
        }
Ejemplo n.º 2
0
        public void RepoSimplePropertiesAreSavedOnUpdate()
        {
            var repo = MakeRepo("Repo1");

            _repo.Create(repo);

            repo.Name            = "SonOfRepo";
            repo.Group           = "RepoGroup";
            repo.AnonymousAccess = true;
            repo.AuditPushUser   = true;
            repo.Description     = "New desc";

            _repo.Update(repo);

            var readBackRepo = _repo.GetRepository("SonOfRepo");

            Assert.AreEqual("SonOfRepo", readBackRepo.Name);
            Assert.AreEqual(repo.Group, readBackRepo.Group);
            Assert.AreEqual(repo.AnonymousAccess, readBackRepo.AnonymousAccess);
            Assert.AreEqual(repo.AuditPushUser, readBackRepo.AuditPushUser);
            Assert.AreEqual(repo.Description, readBackRepo.Description);
        }
Ejemplo n.º 3
0
        public RepositoryUpdateResponse Update([FromBody] RepositoryUpdateRequest request)
        {
            RepositoryUpdateResponse response = new RepositoryUpdateResponse();

            if (request.Id == 0 || request.Id < 0)
            {
                response.Status = -1;
                return(response);
            }

            RepositoryEntity entity = repositoryRepository.GetById(request.Id);

            if (entity == null)
            {
                response.Status = 404;
                return(response);
            }

            repositoryRepository.Update(repositoryConvertor.toEntity(request, entity));

            response.Status = 1;
            return(response);
        }