Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
 private void UpdateCollectionInfo(CardsCollectionPatchInfo collectionToUpdate,
                                   CardsCollection cardFromRepository)
 {
     cardFromRepository.Name = collectionToUpdate.Name;
 }