Skip to content

Commit

Permalink
fix for update
Browse files Browse the repository at this point in the history
  • Loading branch information
woutervanranst committed Aug 21, 2024
1 parent 083af1f commit 810e64c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Arius.Web.Infrastructure/RepositoryRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,19 @@ public async Task AddAsync(Repository repository)

public async Task UpdateAsync(Repository repository)
{
_context.Repositories.Update(repository);
var existingEntity = await _context.Repositories.FindAsync(repository.Id);

if (existingEntity == null)
throw new InvalidOperationException($"Repository with Id {repository.Id} not found.");

existingEntity.LocalPath = repository.LocalPath;
existingEntity.ContainerName = repository.ContainerName;
existingEntity.Passphrase = repository.Passphrase;
existingEntity.Tier = repository.Tier;
existingEntity.RemoveLocal = repository.RemoveLocal;
existingEntity.Dedup = repository.Dedup;
existingEntity.FastHash = repository.FastHash;

await _context.SaveChangesAsync();
}

Expand Down

0 comments on commit 810e64c

Please sign in to comment.