public async void UpdateByIdAsync(CardsCollectionPatchInfo collection, string collectionName, Guid userId) { var collectionFromRepository = await repository.FindByNameAsync(collectionName, userId); if (collectionFromRepository == null) { throw new AppException("Collection not found"); } UpdateCollectionInfo(collection, collectionFromRepository); ValidateCollection(collectionFromRepository); await repository.PatchAsync(collectionFromRepository); }
public async void UpdateByIdAsync(CardsCollectionPatchInfo collection, Guid collectionId, Guid userId) { var collectionFromRepository = await repository.FindByIdAsync(collectionId, userId); if (collectionFromRepository == null) { throw new AppException("Коллекция не найдена"); } UpdateCollectionInfo(collection, collectionFromRepository); ValidateCollection(collectionFromRepository); await repository.PatchAsync(collectionFromRepository); }
private void UpdateCollectionInfo(CardsCollectionPatchInfo collectionToUpdate, CardsCollection cardFromRepository) { cardFromRepository.Name = collectionToUpdate.Name; }